6 Value Properti animationDirection Style DOM pada HTML
Sintak:
- berfungsi untuk mengembalikan properti animationDirection: object.style.animationDirection;
- berfungsi untuk mengatur nilai dari properti animationDirection: object.style.animationDirection = "normal|reverse|alternate|alternate-reverse|initial|inherit"
Property Value: diperlihatkan sebagai berikut.
- normal: berfungsi untuk memainkan animasi ke arah forward, dan juga merupakan nilai default dari properti animationDirection.
- reverse: berfungsi untuk memainkan animasi ke arah reverse.
- alternate: berfungsi untuk memainkan animasi forward dan backward dalam urutan alternatif.
- alternate-reverse: berfungsi untuk memainkan animasi secara backward terlebih dahulu, kemudian forward.
- initial: berfungsi untuk mengaktur properti animationDirection ke nilai default-nya.
- inherit: berfungsi untuk inherit properti animationDirection dari elemen parent-nya.
Contoh:
<!DOCTYPE html>
<html>
<head>
<style>
div
{
color:green;
font-size:70px;
font-weight:bold;
position: relative;
/* Browser Chrome, Safari,
Opera */
-webkit-animation: animate 3s infinite;
animation: animate 3s infinite;}
/* Chrome, Safari, Opera */
@-webkit-keyframes animate
{
from {top: 0px;}
to {top: 200px;}
}
@keyframes animate
{
from {top: 0px;}
to {top: 200px;}
}
</style>
</head>
<body>
<button
onclick = "myBons()">
Click Here!
</button>
<div
id = "MNN">
Blog Elfan
</div>
<script>
function myBons()
{
// Kode untuk Chrome, Safari,
// and Opera
document.getElementById("MNN").style.WebkitAnimationDirection
= "normal";
document.getElementById("MNN").style.animationDirection
= "normal";
}
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<style>
div
{
color:green;
font-size:70px;
font-weight:bold;
position: relative;
/* Chrome, Safari, Opera */
-webkit-animation: animate 3s infinite;
animation: animate 3s infinite;}
/* Chrome, Safari, Opera */
@-webkit-keyframes animate
{
from {top: 0px;}
to {top: 200px;}
}
@keyframes animate
{
from {top: 0px;}
to {top: 200px;}
}
</style>
</head>
<body>
<button
onclick = "myDodons()">
Click Here!
</button>
<div
id = "MKK">
Blog Elfan
</div>
<script>
function myDodons()
{
// Kode program untuk Chrome,
// Safari, and Opera
document.getElementById("MKK").style.WebkitAnimationDirection
= "reverse";
document.getElementById("MKK").style.animationDirection
= "reverse";
}
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<style>
div
{
color:green;
font-size:70px;
font-weight:bold;
position: relative;
/* Chrome, Safari, Opera */
-webkit-animation: animate 3s infinite;
animation: animate 3s infinite;}
/* Chrome, Safari, Opera */
@-webkit-keyframes animate
{
from {top: 0px;}
to {top: 200px;}
}
@keyframes animate
{
from {top: 0px;}
to {top: 200px;}
}
</style>
</head>
<body>
<button
onclick = "myDDDs()">
Click Here!
</button>
<div
id = "DND">
Blog Elfan
</div>
<script>
function myDDDs()
{
// Kode program untuk Chrome,
// Safari, and Opera
document.getElementById("DND").style.WebkitAnimationDirection
= "alternate";
document.getElementById("DND").style.animationDirection
= "alternate";
}
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<style>
div
{
color:green;
font-size:70px;
font-weight:bold;
position: relative;
/* Chrome, Safari, Opera */
-webkit-animation: animate 3s infinite;
animation: animate 3s infinite;}
/* Chrome, Safari, Opera */
@-webkit-keyframes animate
{
from {top: 0px;}
to {top: 200px;}
}
@keyframes animate
{
from {top: 0px;}
to {top: 200px;}
}
</style>
</head>
<body>
<button
onclick = "myBeng2s()">
Click Here!
</button>
<div
id = "MDD">
Blog Elfan
</div>
<script>
function myBeng2s()
{
// Kode program untuk Chrome,
// Safari, and Opera
document.getElementById("MDD").style.WebkitAnimationDirection
= "alternate-reverse";
document.getElementById("MDD").style.animationDirection
= "alternate-reverse";
}
</script>
</body>
</html>
Jenis browser apa saja yang dapat digunakan untuk mengaktifkan properti animationDirection Style DOM pada HTML?
BalasHapusBerikut adalah beberapa jenis browser yang dapat digunakan untuk mengaktifkan properti animationDirection Style DOM pada HTML:
Hapus1. Google Chrome 43.0
2. Firefox 16.0, 5.0 Moz
3. Safari 9.0
4. Opera 30.0
Apa yang dimaksud dengan properti animationDirection Style DOM pada HTML?
BalasHapusProperti animationDirection Style DOM pada HTMl digunakan untuk mengatur atau mengembalikan nilai animasi apakah harus diputar secara terbalik pada siklus alternatif atau tidak.
HapusApa yang akan terjadi pada properti animationDirevtion Style DOM HTMl jika animasi yang diputar hanya dilakukan sekali saja?
BalasHapusJika animasi diatur untuk berputar hanya sekali saja, maka properti animationDirection tidak akan memiliki pengaruh apapun terhadap elemen yang dipengaruhi.
Hapus