Ripple Words
How do I make an ripple words?
What is a ripple words? How do you make a ripple words? This script and codes were developed by Chad Scira on 27 August 2022, Saturday.
Ripple Words - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Ripple Words</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div id="container">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam necromancer mi commodo risus consectetur ullamcorper vitae necromancer augue. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Nulla tempus gravida tempus. Vivamus pharetra mi a mauris posuere fringilla. Mauris dolor lectus, ullamcorper eu ultrices a, pharetra quis erat. Pellentesque suscipit tincidunt nulla, vel pretium libero suscipit Lorem ipsum dolor sit amet, consectetur adipiscing elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam nec mi commodo risus consectetur ullamcorper vitae nec augue. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam necromancer mi commodo risus consectetur ullamcorper vitae necromancer augue. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Nulla tempus gravida tempus. Vivamus pharetra mi a mauris posuere fringilla. Mauris dolor lectus, ullamcorper eu ultrices a, pharetra quis erat. Pellentesque suscipit tincidunt nulla, vel pretium libero suscipit Lorem ipsum dolor sit amet, consectetur adipiscing elit.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam nec mi commodo risus consectetur ullamcorper vitae nec augue. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam necromancer mi commodo risus consectetur ullamcorper vitae necromancer augue. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.</div> <script src="js/index.js"></script>
</body>
</html>
Ripple Words - Script Codes CSS Codes
body { font: 24px helvetica; line-height: 24px; color: #ccc;
}
#container { margin-left: 40px; margin-top: 40px; width: 1200px; word-wrap:break-word; letter-spacing: normal; word-spacing: normal; -webkit-perspective: 600px;
}
word-container { color: transparent;
}
word { -webkit-backface-visibility: hidden;
}
.animate word { -webkit-transform-style: preserve-3d; -webkit-animation-name: pulse; -webkit-animation-duration: .5s; -webkit-animation-timing-function: ease-in-out; -webkit-animation-iteration-count: 1; -webkit-animation-direction: forwards; -webkit-animation-fill-mode: forwards;
}
@-webkit-keyframes pulse { 0% { color: #ccc; -webkit-transform: translateZ(0px); } 50% { color: #d09acd; -webkit-transform: translateZ(125px); } 100% { color: #ccc; -webkit-transform: translateZ(0px); }
}
Ripple Words - Script Codes JS Codes
var animated = [];
function breakUpStringToWords(element) { var html = '', nodes = getChildNodes(element), words = []; nodes.forEach(function (node, key) { var text = node.textContent.match(/([^\s]+|\s)/g), last = null, parent = node.parentNode, fragment = document.createDocumentFragment(), word; for (var i = 0; i < text.length; i++) { word = last = document.createElement('word'); word.innerText = text[i]; fragment.appendChild(word); if (text[i] !== ' ') { word.style.display = 'inline-block'; words.push(word); } } parent.replaceChild(fragment, node); }); words = words.map(function (word) { // word.addEventListener('webkitAnimationEnd', function () { // this.style['-webkit-animation-name'] = ''; // var index = animated.indexOf(word); // //if (index !== -1) animated.splice(index, 1); // }, false); return { element: word, rect: new Rect(word.offsetLeft, word.offsetTop, word.offsetWidth, word.offsetHeight) }; }); return words; function getChildNodes(element, nodes) { nodes = nodes || []; for (var child = 0; child < element.childNodes.length; child++) { var target = element.childNodes[child]; if (target.nodeType == Node.TEXT_NODE) { nodes.push(target); } else if (target.nodeType == Node.ELEMENT_NODE && target.childNodes.length) { getChildNodes(target, nodes); } } if (arguments.length == 1) return nodes; }
}
function Rect(x, y, w, h) { this.x = x; this.y = y; this.w = w; this.h = h;
}
Rect.prototype.distance = function (px, py) { var dx = px - (this.x + (this.w / 2)), dy = py - (this.y + (this.h / 2)); return Math.sqrt(dx * dx + dy * dy);
};
Rect.prototype.circleContains = function (px, py, distance) { return this.distance(px, py) < distance;
};
Rect.prototype.contains = function (x, y) { return this.x < x && (this.x + this.w) > x && this.y < y && (this.y + this.h) > y;
}
var start = Date.now(), iteration = 0, distance = 1, words = breakUpStringToWords(document.getElementById('container'));
var delays = [];
words.forEach(function (word) { // console.log(word.rect.distance(150, 150)) word.element.style['-webkit-animation-delay'] = (word.rect.distance(150, 150) * 1.2) + 'ms';
});
document.getElementById('container').className = 'animate';
console.log(Date.now() - start, words.length);
Developer | Chad Scira |
Username | icodeforlove |
Uploaded | August 27, 2022 |
Rating | 3 |
Size | 3,081 Kb |
Views | 50,600 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
Animated 3D Text | 3,272 Kb |
A Pen by Chad Scira | 2,150 Kb |
Delayed Follow | 2,306 Kb |
FizzBuzz CAPTCHA | 2,568 Kb |
Dippin Dots | 2,459 Kb |
Text Vortex | 6,534 Kb |
Curl Request to Node Request | 3,000 Kb |
FontAwesome | 4,360 Kb |
CSS Voxel Animation | 3,005 Kb |
Canvas Text Vortex | 3,252 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
Shop Talk logo made in CSS | Hugo | 19,368 Kb |
Custom Checkbox and radio inputs SCSS | Rgfx | 3,367 Kb |
Default Input, Textareas, Submits, and Buttons in iOS | Demersdesigns | 2,334 Kb |
Colorful Sliders | Chanrith | 1,246 Kb |
CSSOff 2013 Submission | Codewunder | 14,766 Kb |
Tab panels | Accessibility | 0 Kb |
Expandable Left Side Bar with jQuery animate | Retrofuturistic | 2,483 Kb |
Wave Lines | Mikehobizal | 4,023 Kb |
Animated SVG stroke-dasharray | Netsi1964 | 3,179 Kb |
HTML5 Breakout | Jaysalvat | 4,873 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!