<div class="wrapper">
<div class="container">
<p data-typing="i"></p>
<p data-typing="frontend"></p>
<p data-typing="engineer"></p>
<p data-typing="with"></p>
<p data-typing="javascript"></p>
<p data-typing="typescript"></p>
<p data-typing="css"></p>
<p data-typing="nodejs"></p>
<p data-typing="animation"></p>
<a href="https://github.com/daybrush/scenejs" target="_blank" data-typing="scenejs"></a>
<div class="origin"></div>
</div>
</div>
@import url('https://fonts.googleapis.com/css?family=Raleway:900&display=swap');
html, body {
position: relative;
height: 100%;
font-family: 'Raleway', sans-serif;
font-size: 20px;
margin: 0;
padding: 0;
overflow: hidden;
}
* {
box-sizing: border-box;
}
.wrapper {
position: absolute;
width: 300px;
height: 300px;
top: 50%;
left: 50%;
transform: translate(-50%, -50%) translateY(20px) scale(1.5);
overflow: hidden;
}
@media screen and (max-width: 600px) {
.wrapper {
transform: translate(-50%, -50%) scale(1);
}
}
.container {
position: absolute;
width: 300px;
height: 300px;
}
[data-typing] {
position: absolute;
top: 0;
/* border: 1px solid #f55; */
transform-origin: 0% 0%;
font-size: 25px;
margin: 0;
padding: 0;
top: 100px;
line-height: 1;
color: #333;
}
[data-typing]:before {
content: "";
}
[data-typing="i"] {
top: 0;
left: 50px;
font-size: 90px;
height: 70px;
line-height: 70px;
}
[data-typing="frontend"] {
top: 3px;
left: 80px;
font-size: 27px;
letter-spacing: 1px;
}
[data-typing="engineer"] {
top: 30px;
left: 80px;
font-size: 40px;
letter-spacing: 1px;
}
[data-typing="with"] {
top: 74px;
left: 265px;
font-size: 36px;
transform: rotate(90deg);
background: #333;
color: #fff;
padding: 0px 4px;
}
[data-typing="javascript"] {
top: 74px;
left: 229px;
transform: rotate(90deg);
font-size: 35px;
}
[data-typing="typescript"] {
top: 72px;
right: 110px;
font-size: 25px;
}
[data-typing="css"] {
top: 97px;
right: 110px;
font-size: 40px;
}
[data-typing="nodejs"] {
top: 134px;
right: 110px;
font-size: 35px;
}
[data-typing="animation"] {
top: 167px;
right: 110px;
font-size: 35px;
}
[data-typing="scenejs"] {
top: 200px;
right: 110px;
font-size: 35px;
}
a {
color: #333;
text-decoration: none;
}
body .scenejs-editor-timeline {
position: fixed;
bottom: 0;
max-height: 300px;
}
/*
https://github.com/daybrush/scenejs
*/
const scene = new Scene({
".container": {}
}, {
selector: true,
});
const item = scene.getItem(".container");
function move(startTime, endTime, left, top, rotate, scale) {
const frame = Scene.kineticFrame({
left: `${left}px`,
top: `${top}px`
}).set({
transform: {
rotate: `${rotate}deg`,
scale,
}
})
item.set({
[startTime]: frame,
[endTime]: frame,
});
}
move(0, 0, 90, 115, 0, 5);
move(1, 1, 90, 115, 0, 2);
move(2, 3, 0, 115, 0, 1);
move(4, 4.5, -100, 0, -90, 2);
move(5.5, 6, -52, -18, -90, 1.6);
move(7, 7.5, 30, 45, 0, 2);
move(8.5, 9, 10, 30, 0, 3);
move(10, 10.5, 28, 0, 0, 2.2);
move(11.5, 12, 50, -35, 0, 1.65);
move(13, 13.5, 35, -70, 0, 2);
move(14.5, 18, 0, 0, 0, 1);
function typing(text, duration = 1) {
return Scene.typing({ prefix: "\"", suffix: "\"", property: "content", text: text, duration: duration });
}
scene.set({
"[data-typing='i']:before": typing("I "),
"[data-typing='frontend']:before": { 1: typing("'m Front-End") },
"[data-typing='engineer']:before": { 1.5: typing("Engineer") },
"[data-typing='with']:before": { 3.3: typing("with", 0.5) },
"[data-typing='javascript']:before": { 4.5: typing("JavaScript") },
"[data-typing='typescript']:before": { 6: typing("TypeScript") },
"[data-typing='css']:before": { 7.5: typing("CSS", 0.7) },
"[data-typing='nodejs']:before": { 9: typing("Node.js") },
"[data-typing='animation']:before": { 10.5: typing("Animation") },
"[data-typing='scenejs']:before": { 12: typing("Scene.js") },
});
scene.setPlaySpeed(1);
scene.setEasing("ease-in-out");
scene.setIterationCount("infinite");
scene.playCSS();
// new Timeline(scene, document.body)
View Compiled
This Pen doesn't use any external CSS resources.