Posts

Showing posts with the label animation

I need help making an interactive sprite in JS

I need help making an interactive sprite in JS I want to use a gif I made for my sprite (it would be nice if the gif only played when the character moved) So far, I have a rectangle with choppy character movements. (It would also be nice if I could make the character movement smoother. I watched tons of tutorials but I couldn't find anything that shows how to do what I want to do. Here is the code (you can ignore css) <!DOCTYPE html> <html> <head> <style type="text/css"> #backgroundColor { width: 100px; height: 100px; background-color: white; animation-name: backgroundChange; animation-duration: 45s; animation-iteration-count: infinite; } @keyframes backgroundChange { 0% {background-color: white;} 3.3% {background-color: #ffc5c5;} 6.6% {background-color: #f78a8a;} ...

How can I repeat a property animation?

How can I repeat a property animation? I'm doing an animation of bubbles on the screen, but the bubbles stop after finishing the animation time. How do I repeat the animation or make it infinite? bub.animate(); bub.animate().x(x2).y(y2); bub.animate().setDuration(animationTime); bub.animate().setListener(new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animation) { animators.add(animation); } @Override public void onAnimationRepeat(Animator animation) { } @Override public void onAnimationEnd(Animator animation) { } }); possible duplicate of How to generate looping animation with ViewPropertyAnimator? – kaka Aug 17 '14 at 0:12 You can also use ValueAnimator which supports repeats, developer.android.com/reference/android/anima...