Ripple Words

Developer
Size
3,081 Kb
Views
50,600

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 Previews

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);
Ripple Words - Script Codes
Ripple Words - Script Codes
Home Page Home
Developer Chad Scira
Username icodeforlove
Uploaded August 27, 2022
Rating 3
Size 3,081 Kb
Views 50,600
Do you need developer help for Ripple Words?

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!

Chad Scira (icodeforlove) Script Codes
Create amazing captions with AI!

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!