Jump to content

BobieBobie

Members
  • Posts

    18
  • Joined

  • Last visited

BobieBobie's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Glad to hear that. Tomorrow morning I will test your code on third machine(much better performance) and see if the animation is smooth. Ty again.
  2. I cannot migrate to the latest version, because not all of the required mods currently support newer versions.
  3. Of course, nothing changed except the speed. Rewatch the second video. I am having lower FPS there (100+ players nearby) and animations are damn smooth. I cannot achieve that.
  4. On the first, weak machine around 20 frames. On another around 70. Both have the same issue. And I can notice why. PartialTicks are unequal, so that xOffset is unstable, which causes jumping animation.
  5. Of course no. Compare both animations. Mine is laggy, not smooth. And the other one is so smooth. No lagging at all.
  6. P.S.S In my version I have disabled restrictions on movement, so you can easily notice lagging animation.
  7. Captured two videos for you. First one is mine, second one shows desired version. P.S. Look only on the top left corner, it contains "notification". https://www.dropbox.com/s/kuh50e4tvnqn1kg/my notif.mp4?dl=0 https://www.dropbox.com/s/xle16vgqqjvz4kn/desired one.mp4?dl=0
  8. I will post a video as soon as possible.
  9. https://gist.github.com/BobieBobie/a9b53635845f661bb428834c5a4e25f0
  10. Ok. Imagine drawing a rectangle with built-in drawRect function from Gui class. I am trying to move it SMOOTHLY across the screen. To be more simple: have you ever seen Windows 10 Notifications, that appear from the right bottom side of the screen? Thats what I am trying to recreate. Now it is moving "unstable", not smooth. Maybe I need to change incrementation of current value to much smaller value, but if I will do that - the speed of animation will be VEEERY slow. Reminding Windows 10 notification. Fast and smooth. Offset? That is a number which represents how far will the rectangle move on the next frame.
  11. Did everything you wrote: I am updating current every tick and rendering every frame. I logged the offset to the console and noticed that offset is not equal. I mean this: Here is an updated code: Every RenderGameOverlayEvent.Post: float actualValue = this.lastTick + (this.current - this.lastTick) * partialTicks; this.currentNotification.draw(actualValue); ClientTickEvent: @SubscribeEvent public void onClientTick(TickEvent.ClientTickEvent event) { if (event.phase != TickEvent.Phase.END) return; NotificationsMod.NMANAGER.updateCurrent(); } updateCurrent method: public void updateCurrent() { if (this.currentNotification == null) return; this.lastTick = this.current; this.current += 2F; // Bigger number - faster animation } Even if I do this.current++; animation/offset are not "pretty". Is that normal? Or am I stupid?
  12. OK, I am a bit closer. You said How can I get every tick? As far as I know RenderGameOverlayEvent is called every FRAME, right? So how can I manage to get every TICK?
  13. Am I on the right way?: private float current = 1, lastTick = 1; // "1" is wrong, cause it will lead to 0. It is obvious. /*....*/ this.lastTick = this.current; this.current = this.lerp(partialTicks); this.currentNotification.draw(this.current); /*....*/ private float lerp(float partialTicks) { return this.lastTick + (this.current - this.lastTick) * partialTicks; }
  14. @diesieben07, I got the logic, but imagine that current and lastTick get 0, so that accordingly to the formula actual = 0 + (0 - 0) * 0.xxxxx always equals zero. So current value will be 0. Next time it will repeat, again and again.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.