CodeLab
Tutorials For Everyone
Run
Learn CSS
<!DOCTYPE html> <html> <head> <style> #container { width: 330px; height: 180px; margin: auto; position: relative; box-shadow: 0 0 10px 0 #aaa; background: #333; } #circle { border: solid red 10px; height: 10px; width: 10px; border-radius: 50%; position: absolute; z-index: 2; box-sizing: border-box; offset-path: path('M 30 80 L 300 80'); animation: circle-anim 5s infinite; } #block { position: absolute; width: 50px; height: 50px; background: blue; z-index: 1; offset-path: path('M 30 80 L 300 80'); offset-anchor: bottom left; animation: anchor-anim 5s infinite; overflow: visible; } svg { position: absolute; height: 100%; width: 100%; left: 0; top: 0; } @keyframes anchor-anim { 0% { offset-distance: 0%; offset-rotate: auto 0deg } 50% { offset-distance: 100%; offset-rotate: auto 180deg } 100% { offset-distance: 0%;offset-rotate: auto 360deg } } @keyframes circle-anim { 0% { offset-distance: 0%; } 50% { offset-distance: 100%; } 100% { offset-distance: 0%; } } </style> </head> <body> <h1>Animatable 'offset-rotate' Property</h1> <hr> <p>The blue box moves and rotate along the path.</p> <div id="container"> <div id="block"></div> <div id="circle"></div> <svg> <path d="M 30 80 L 300 80" fill="none" stroke="white" stroke-width="2" stroke-dasharray="5,5"/> </svg> </div> </body> </html>
Editor Commands
Ctrl
F
Find
Ctrl
G
Find Next
Ctrl
⇧
G
Find Previous
Ctrl
⇧
F
Find & Replace
Ctrl
]
Indent Code Right
Ctrl
[
Indent Code Left
⇧
Tab
Auto Indent Code
Ctrl
/
Line Comment
Ctrl
Alt
/
Block Comment
TutsInsider Actions
Alt
S
Run Code
Ctrl
C
Copy Editor Code
Ctrl
A
Select All Editor Code
Ctrl
S
Save/Download
Ctrl
Alt
X
Rotate
Ctrl
Alt
T
Switch Theme
Ctrl
⇧
C
Open Console
Esc
Close Console