Last active
July 15, 2021 22:16
-
-
Save aledwassell/d0f37baacf8fff889a03c024b99b29fb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var type = 'antonym'; | |
var url = 'http://api.wordnik.com:80/v4/word.json/'; | |
var url2 = '/relatedWords?useCanonical=false&relationshipTypes='; | |
var url3 = '&limitPerRelationshipType=10&api_key=a2a73e7b926c924fad7001ca3111acd55af2ffabf50eb4ae5'; | |
var button; | |
var input; | |
var output; | |
function setup() { | |
noCanvas(); | |
input = createInput(''); | |
button = createButton('Submit'); | |
button.mousePressed(askWordnik); | |
input.changed(askWordnik); | |
} | |
function askWordnik(){ | |
loadJSON(url + input.value() + url2 + type + url3, gotData); | |
} | |
function gotData(data){ | |
var index1 = floor(random(data[0].words[0])); | |
output = createP(data[0].words); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment