Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
学ぶ Your First Animation | Anime.js Essentials and Core Animation
JavaScript Animation with Anime.js

bookYour First Animation

メニューを表示するにはスワイプしてください

index.html

index.html

copy

To create your first animation with Anime.js, you start by selecting the element you want to animate. In this case, you use a div with the id "box". This box is styled with a fixed width and height, a blue background, and an initial position on the page using CSS. The opacity is set to 0.5 so you can see the change as it animates.

Next, you include the Anime.js library by adding a script tag with its CDN link. This allows you to use Anime.js functions in your script.

The animation itself is triggered by calling the anime function. You pass in an object that describes what you want to animate:

  • The targets property specifies which element to animate. Here, you target the box using "#box";
  • You define the properties to animate. Setting left: '400px' moves the box horizontally, and opacity: 1 makes it fully visible;
  • The duration property sets how long the animation will take in milliseconds. Here, the animation lasts 2000 milliseconds (2 seconds);
  • The easing property controls the speed curve of the animation. Using 'easeInOutQuad' creates a smooth start and end.

When the script runs, Anime.js automatically animates the box: it slides from its original position to 400px from the left and fades in to full opacity.

1. When animating a box's position and opacity with Anime.js, which of the following is necessary?

2. Which property would you animate to make an element fade in or out?

question mark

When animating a box's position and opacity with Anime.js, which of the following is necessary?

すべての正しい答えを選択

question mark

Which property would you animate to make an element fade in or out?

正しい答えを選んでください

すべて明確でしたか?

どのように改善できますか?

フィードバックありがとうございます!

セクション 1.  2

AIに質問する

expand

AIに質問する

ChatGPT

何でも質問するか、提案された質問の1つを試してチャットを始めてください

セクション 1.  2
some-alt