css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

              <div class="form">
	<p>Search for a keyword in recent posts from <br /><span id="site-url"></span></p>
	<input type="text" name="keyword" id="myText" value="" />
	<button onclick="checker()">Search</button>
              body {
	margin: 0;
	font-family: sans-serif;

p {
	color: rgba(255,255,255,0.65);
	letter-spacing: 1px;
	font-size: 18px;
	margin-top: 0;

.form {
	position: absolute;
	top: 40px;
	left: 40px;
	font-size: 18px;

input[type="text"] {
	padding: 7px 10px;
	font-size: 18px;
	display: inline-block;
	height: 20px;
	border: none;
	border-radius: 3px 0 0 3px;
	position: relative;
	top: 0;

button {
	font-size: 14px;
	text-transform: uppercase;
	padding: 9px 10px;
	position: relative;
	top: -1px;
	border: none;
	background: #fff;
	margin-left: -5px;
	border-left: 1px solid #ccc;
	border-radius: 0 3px 3px 0;
	display: inline-block;
	height: 34px;
	&:hover {
		box-shadow: 0 0 4px rgba(0,0,0,0.4);
		cursor: pointer;
              // Global variables.
var json;
var url = "https://westmichigan.aiga.org/wp-json/wp/v2/posts?per_page=10";
var keyword;
var words = [];

// Assigning JSON to a variable and preloading all of it up front.
function preload() {
	json = loadJSON(url);

// Checking form for keyword and storing it in HTML5 local storage.
function checker() {
	keyword = document.getElementById("myText").value;
	localStorage.setItem("myText", keyword);

// p5.js setup function.
function setup() {
	document.getElementById('site-url').innerHTML = url;
	createCanvas(windowWidth, windowHeight);
	for (var i = 0; i < json.length; i++) {
		var j = json[i];
		words[i] = new Word(j);
	// Showing the entered keyword in the input field.
	document.getElementById("myText").value = localStorage.getItem("myText");

// p5.js draw function.
function draw() {
	// Assigning the number of objects to a variable called 'count'.
	var count = Object.keys(json).length;
	var diameter = 45;
	// Looping through the JSON posts.
	for(var i = 0; i <= count; i++) {
		// Assigning post content to a variable.
		var content = json[i].content.rendered;
		// Searching content of post for specified string.
		// var word_count = (content.match(/diversity/g) || []).length; // This matches a string
		// Recalling the value from local storage and counting how many times it appears in each post.
		keyword = localStorage.getItem("myText");
		var word = new RegExp(keyword, 'g');
		var word_count = (content.match(word) || []).length;
		// Remapping the x_axis of ellipses
		var x_axis = map(i, 0, count-1, 0 + diameter, width - diameter);
		// Display a black ellipse for every post and color posts with specified word blue.
		if (content.indexOf(keyword) > -1) {
			fill(88,200,221); // Blue
		} else {
		ellipse(x_axis, height/2, diameter + word_count * 10, diameter + word_count * 10);
		// Displaying number of times a word is used in post.
		if (content.indexOf(keyword) > -1) {
		} else {
			fill(255,255,255, 80);
		textAlign(CENTER, CENTER);
		text(word_count, x_axis, height/2);

🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................