Adding an early version of js dom library. Fancy lines example passing (others failing)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
package js.dom
|
||||
package js.dom.core
|
||||
|
||||
import js.native
|
||||
import js.noImpl
|
||||
@@ -9,17 +9,17 @@ public native trait DOMImplementationRegistry {
|
||||
}
|
||||
|
||||
public native trait DOMException {
|
||||
public native var code: Number = js.noImpl
|
||||
public native var code: Double = js.noImpl
|
||||
}
|
||||
|
||||
public native trait DOMStringList {
|
||||
public native val length: Number = js.noImpl
|
||||
public native val length: Double = js.noImpl
|
||||
public native fun item(index: Number): String = js.noImpl
|
||||
public native fun contains(str: String): Boolean = js.noImpl
|
||||
}
|
||||
|
||||
public native trait NameList {
|
||||
public native val length: Number = js.noImpl
|
||||
public native val length: Double = js.noImpl
|
||||
public native fun getName(index: Number): String = js.noImpl
|
||||
public native fun getNamespaceURI(index: Number): String = js.noImpl
|
||||
public native fun contains(str: String): Boolean = js.noImpl
|
||||
@@ -27,7 +27,7 @@ public native trait NameList {
|
||||
}
|
||||
|
||||
public native trait DOMImplementationList {
|
||||
public native val length: Number = js.noImpl
|
||||
public native val length: Double = js.noImpl
|
||||
public native fun item(index: Number): DOMImplementation? = js.noImpl
|
||||
}
|
||||
|
||||
@@ -66,11 +66,11 @@ public native trait Document : Node {
|
||||
public native fun createProcessingInstruction(target: String, data: String): ProcessingInstruction? = js.noImpl
|
||||
public native fun createAttribute(name: String): Attr? = js.noImpl
|
||||
public native fun createEntityReference(name: String): EntityReference? = js.noImpl
|
||||
public native fun getElementsByTagName(tagname: String): NodeList? = js.noImpl
|
||||
public native fun getElementsByTagName(tagname: String): NodeList = js.noImpl
|
||||
public native fun importNode(importedNode: Node, deep: Boolean): Node? = js.noImpl
|
||||
public native fun createElementNS(namespaceURI: String, qualifiedName: String): Element? = js.noImpl
|
||||
public native fun createAttributeNS(namespaceURI: String, qualifiedName: String): Attr? = js.noImpl
|
||||
public native fun getElementsByTagNameNS(namespaceURI: String, localName: String): NodeList? = js.noImpl
|
||||
public native fun getElementsByTagNameNS(namespaceURI: String, localName: String): NodeList = js.noImpl
|
||||
public native fun getElementById(elementId: String): Element? = js.noImpl
|
||||
public native fun adoptNode(source: Node): Node? = js.noImpl
|
||||
public native fun normalizeDocument(): Unit = js.noImpl
|
||||
@@ -80,7 +80,7 @@ public native trait Document : Node {
|
||||
public native trait Node {
|
||||
public native val nodeName: String = js.noImpl
|
||||
public native var nodeValue: String = js.noImpl
|
||||
public native val nodeType: Number = js.noImpl
|
||||
public native val nodeType: Double = js.noImpl
|
||||
public native val parentNode: Node = js.noImpl
|
||||
public native val childNodes: NodeList = js.noImpl
|
||||
public native val firstChild: Node = js.noImpl
|
||||
@@ -115,12 +115,12 @@ public native trait Node {
|
||||
}
|
||||
|
||||
public native trait NodeList {
|
||||
public native val length: Number = js.noImpl
|
||||
public native val length: Double = js.noImpl
|
||||
public native fun item(index: Number): Node? = js.noImpl
|
||||
}
|
||||
|
||||
public native trait NamedNodeMap {
|
||||
public native val length: Number = js.noImpl
|
||||
public native val length: Double = js.noImpl
|
||||
public native fun getNamedItem(name: String): Node? = js.noImpl
|
||||
public native fun setNamedItem(arg: Node): Node? = js.noImpl
|
||||
public native fun removeNamedItem(name: String): Node? = js.noImpl
|
||||
@@ -132,7 +132,7 @@ public native trait NamedNodeMap {
|
||||
|
||||
public native trait CharacterData : Node {
|
||||
public native var data: String = js.noImpl
|
||||
public native val length: Number = js.noImpl
|
||||
public native val length: Double = js.noImpl
|
||||
public native fun substringData(offset: Number, count: Number): String = js.noImpl
|
||||
public native fun appendData(arg: String): Unit = js.noImpl
|
||||
public native fun insertData(offset: Number, arg: String): Unit = js.noImpl
|
||||
@@ -158,13 +158,13 @@ public native trait Element : Node {
|
||||
public native fun getAttributeNode(name: String): Attr? = js.noImpl
|
||||
public native fun setAttributeNode(newAttr: Attr): Attr? = js.noImpl
|
||||
public native fun removeAttributeNode(oldAttr: Attr): Attr? = js.noImpl
|
||||
public native fun getElementsByTagName(name: String): NodeList? = js.noImpl
|
||||
public native fun getElementsByTagName(name: String): NodeList = js.noImpl
|
||||
public native fun getAttributeNS(namespaceURI: String, localName: String): String = js.noImpl
|
||||
public native fun setAttributeNS(namespaceURI: String, qualifiedName: String, value: String): Unit = js.noImpl
|
||||
public native fun removeAttributeNS(namespaceURI: String, localName: String): Unit = js.noImpl
|
||||
public native fun getAttributeNodeNS(namespaceURI: String, localName: String): Unit = js.noImpl
|
||||
public native fun setAttributeNodeNS(newAttr: Attr): Unit = js.noImpl
|
||||
public native fun getElementsByTagNameNS(namespaceURI: String, localName: String): NodeList? = js.noImpl
|
||||
public native fun getElementsByTagNameNS(namespaceURI: String, localName: String): NodeList = js.noImpl
|
||||
public native fun hasAttribute(name: String): Boolean = js.noImpl
|
||||
public native fun hasAttributeNS(namespaceURI: String, localName: String): Boolean = js.noImpl
|
||||
public native fun setIdAttribute(name: String, isId: Boolean): Unit = js.noImpl
|
||||
@@ -194,7 +194,7 @@ public native trait UserDataHandler {
|
||||
}
|
||||
|
||||
public native trait DOMError {
|
||||
public native var severity: Number = js.noImpl
|
||||
public native var severity: Double = js.noImpl
|
||||
public native var message: String = js.noImpl
|
||||
public native var `type`: String = js.noImpl
|
||||
public native var relatedException: Any = js.noImpl
|
||||
@@ -207,10 +207,10 @@ public native trait DOMErrorHandler {
|
||||
}
|
||||
|
||||
public native trait DOMLocator {
|
||||
public native var lineNumber: Number = js.noImpl
|
||||
public native var columnNumber: Number = js.noImpl
|
||||
public native var byteOffset: Number = js.noImpl
|
||||
public native var utf16Offset: Number = js.noImpl
|
||||
public native var lineNumber: Double = js.noImpl
|
||||
public native var columnNumber: Double = js.noImpl
|
||||
public native var byteOffset: Double = js.noImpl
|
||||
public native var utf16Offset: Double = js.noImpl
|
||||
public native var relatedNode: Node = js.noImpl
|
||||
public native var uri: String = js.noImpl
|
||||
}
|
||||
@@ -0,0 +1,702 @@
|
||||
package js.dom.html
|
||||
|
||||
import js.native
|
||||
import js.noImpl
|
||||
import js.dom.core.*
|
||||
|
||||
public native trait Object {
|
||||
|
||||
}
|
||||
|
||||
public native trait Image : HTMLImageElement {
|
||||
|
||||
}
|
||||
|
||||
public native trait Navigator {
|
||||
public native var userAgent: String = js.noImpl
|
||||
public native var product: String = js.noImpl
|
||||
public native var appVersion: String = js.noImpl
|
||||
public native var appName: String = js.noImpl
|
||||
public native var appCodeName: String = js.noImpl
|
||||
public native var language: String = js.noImpl
|
||||
public native var mimeTypes: Array<Any?> = js.noImpl
|
||||
public native var platform: Array<Any?> = js.noImpl
|
||||
public native var plugins: String = js.noImpl
|
||||
public native fun taintEnabled(): Boolean = js.noImpl
|
||||
public native fun javaEnabled(): Boolean = js.noImpl
|
||||
public native fun preference(prefName: String, prefValue: String): String = js.noImpl
|
||||
}
|
||||
|
||||
public native trait Screen {
|
||||
public native var width: Double = js.noImpl
|
||||
public native var height: Double = js.noImpl
|
||||
public native var availHeight: Double = js.noImpl
|
||||
public native var availWidth: Double = js.noImpl
|
||||
public native var pixelDepth: Double = js.noImpl
|
||||
public native var colorDepth: Double = js.noImpl
|
||||
}
|
||||
|
||||
public native trait Option {
|
||||
public native var defaultSelected: Boolean = js.noImpl
|
||||
public native var selected: Boolean = js.noImpl
|
||||
public native var text: String = js.noImpl
|
||||
public native var value: String = js.noImpl
|
||||
}
|
||||
|
||||
public native trait Location {
|
||||
public native var href: String = js.noImpl
|
||||
public native var hash: String = js.noImpl
|
||||
public native var port: String = js.noImpl
|
||||
public native var host: String = js.noImpl
|
||||
public native var hostname: String = js.noImpl
|
||||
public native var pathname: String = js.noImpl
|
||||
public native var protocol: String = js.noImpl
|
||||
public native var search: String = js.noImpl
|
||||
public native var target: String = js.noImpl
|
||||
public native fun reload(): Unit = js.noImpl
|
||||
public native fun replace(url: String): Unit = js.noImpl
|
||||
}
|
||||
|
||||
public native trait Event {
|
||||
public native var data: Array<Any> = js.noImpl
|
||||
public native var height: Double = js.noImpl
|
||||
public native var screenX: Double = js.noImpl
|
||||
public native var clientX: Double = js.noImpl
|
||||
public native var pageX: Double = js.noImpl
|
||||
public native var screenY: Double = js.noImpl
|
||||
public native var clientY: Double = js.noImpl
|
||||
public native var pageY: Double = js.noImpl
|
||||
public native var width: Double = js.noImpl
|
||||
public native var modifiers: Double = js.noImpl
|
||||
public native var keyCode: Double = js.noImpl
|
||||
public native var `type`: String = js.noImpl
|
||||
public native var which: Any = js.noImpl
|
||||
public native var altKey: Boolean = js.noImpl
|
||||
public native var ctrlKey: Boolean = js.noImpl
|
||||
public native var shiftKey: Boolean = js.noImpl
|
||||
public native var button: Boolean = js.noImpl
|
||||
}
|
||||
|
||||
public native trait Selection {
|
||||
|
||||
}
|
||||
|
||||
public native trait document {
|
||||
public native var styleSheets: Array<Stylesheet> = js.noImpl
|
||||
}
|
||||
|
||||
public native trait CSSRule {
|
||||
public native var selectorText: String = js.noImpl
|
||||
}
|
||||
|
||||
public native trait Stylesheet {
|
||||
|
||||
}
|
||||
|
||||
public native trait History {
|
||||
public native fun back(): Unit = js.noImpl
|
||||
public native fun forward(): Unit = js.noImpl
|
||||
public native fun go(count: Number): Unit = js.noImpl
|
||||
}
|
||||
|
||||
public native trait Console {
|
||||
public native fun log(message: Any): Unit = js.noImpl
|
||||
}
|
||||
|
||||
public native trait Window {
|
||||
public native val document: HTMLDocument = js.noImpl
|
||||
public native val event: Event = js.noImpl
|
||||
public native val navigator: Navigator = js.noImpl
|
||||
public native val screen: Screen = js.noImpl
|
||||
public native val location: Location = js.noImpl
|
||||
public native var frameElement: Any = js.noImpl
|
||||
public native var opener: Window = js.noImpl
|
||||
public native var window: Window = js.noImpl
|
||||
public native var parent: Window = js.noImpl
|
||||
public native var top: Window = js.noImpl
|
||||
public native var self: Any = js.noImpl
|
||||
public native var frames: Array<Any?> = js.noImpl
|
||||
public native var innerHeight: Double = js.noImpl
|
||||
public native var innerWidth: Double = js.noImpl
|
||||
public native var outerHeight: Double = js.noImpl
|
||||
public native var outerWidth: Double = js.noImpl
|
||||
public native var scrollX: Double = js.noImpl
|
||||
public native var scrollY: Double = js.noImpl
|
||||
public native var pageXOffset: Double = js.noImpl
|
||||
public native var pageYOffset: Double = js.noImpl
|
||||
public native var scrollMaxX: Double = js.noImpl
|
||||
public native var scrollMaxY: Double = js.noImpl
|
||||
public native var status: String = js.noImpl
|
||||
public native var defaultStatus: String = js.noImpl
|
||||
public native var toolbar: Any = js.noImpl
|
||||
public native var menubar: Any = js.noImpl
|
||||
public native var scrollbars: Any = js.noImpl
|
||||
public native var directories: Any = js.noImpl
|
||||
public native var history: History = js.noImpl
|
||||
public native fun open(strUrl: String, strWindowName: String, strWindowFeatures: String): Window? = js.noImpl
|
||||
public native fun print(): Unit = js.noImpl
|
||||
public native fun clearInterval(intervalId: Number): Unit = js.noImpl
|
||||
public native fun clearTimeout(intervalId: Number): Unit = js.noImpl
|
||||
public native fun setInterval(vCode: () -> Unit, iMillis: Number): Double? = js.noImpl
|
||||
public native fun setInterval(vCode: String, iMillis: Number): Double? = js.noImpl
|
||||
public native fun setTimeout(vCode: () -> Unit, iMillis: Number): Double? = js.noImpl
|
||||
public native fun setTimeout(vCode: String, iMillis: Number): Double? = js.noImpl
|
||||
public native fun scrollTo(x: Number, y: Number): Unit = js.noImpl
|
||||
public native fun scrollBy(xDelta: Number, yDelta: Number): Unit = js.noImpl
|
||||
public native fun moveTo(x: Number, y: Number): Unit = js.noImpl
|
||||
public native fun moveBy(xDelta: Number, yDelta: Number): Unit = js.noImpl
|
||||
public native fun resizeTo(width: Number, height: Number): Unit = js.noImpl
|
||||
public native fun resizeBy(widthDelta: Number, heightDelta: Number): Unit = js.noImpl
|
||||
public native var onload: () -> Unit = js.noImpl
|
||||
public native var onunload: () -> Unit = js.noImpl
|
||||
}
|
||||
|
||||
public native trait Global {
|
||||
public native val window: Window = js.noImpl
|
||||
public native fun escape(str: String): Unit = js.noImpl
|
||||
public native fun unescape(str: String): Unit = js.noImpl
|
||||
}
|
||||
|
||||
public native trait HTMLCollection {
|
||||
public native val length: Double = js.noImpl
|
||||
public native fun item(index: Number): Node? = js.noImpl
|
||||
public native fun namedItem(name: String): Node? = js.noImpl
|
||||
}
|
||||
|
||||
public native trait HTMLOptionsCollection {
|
||||
public native val length: Double = js.noImpl
|
||||
public native fun item(index: Number): Node? = js.noImpl
|
||||
public native fun namedItem(name: String): Node? = js.noImpl
|
||||
}
|
||||
|
||||
public native trait HTMLDocument : Document {
|
||||
public native var title: String = js.noImpl
|
||||
public native val referrer: String = js.noImpl
|
||||
public native val domain: String = js.noImpl
|
||||
public native val URL: String = js.noImpl
|
||||
public native var body: HTMLElement = js.noImpl
|
||||
public native val images: HTMLCollection = js.noImpl
|
||||
public native val applets: HTMLCollection = js.noImpl
|
||||
public native val links: HTMLCollection = js.noImpl
|
||||
public native val forms: HTMLCollection = js.noImpl
|
||||
public native val anchors: HTMLCollection = js.noImpl
|
||||
public native var cookie: HTMLCollection = js.noImpl
|
||||
public native fun open(): Unit = js.noImpl
|
||||
public native fun close(): Unit = js.noImpl
|
||||
public native fun write(text: String): Unit = js.noImpl
|
||||
public native fun writeln(text: String): Unit = js.noImpl
|
||||
public native fun getElementsByName(elementName: String): NodeList = js.noImpl
|
||||
public native var compatMode: String = js.noImpl
|
||||
public native var onload: () -> Unit = js.noImpl
|
||||
public native var onunload: () -> Unit = js.noImpl
|
||||
}
|
||||
|
||||
public native trait HTMLElement : Element {
|
||||
public native var id: String = js.noImpl
|
||||
public native var title: String = js.noImpl
|
||||
public native var lang: String = js.noImpl
|
||||
public native var dir: String = js.noImpl
|
||||
public native var className: String = js.noImpl
|
||||
public native var style: CSSStyleDeclaration = js.noImpl
|
||||
public native var clientWidth: Double = js.noImpl
|
||||
public native var clientHeight: Double = js.noImpl
|
||||
public native var clientTop: Double = js.noImpl
|
||||
public native var clientLeft: Double = js.noImpl
|
||||
public native var innerHTML: String = js.noImpl
|
||||
public native var offsetWidth: Double = js.noImpl
|
||||
public native var offsetHeight: Double = js.noImpl
|
||||
public native var offsetTop: Double = js.noImpl
|
||||
public native var offsetLeft: Double = js.noImpl
|
||||
public native var offsetParent: Double = js.noImpl
|
||||
public native var scrollWidth: Double = js.noImpl
|
||||
public native var scrollHeight: Double = js.noImpl
|
||||
public native var scrollTop: Double = js.noImpl
|
||||
public native var scrollLeft: Double = js.noImpl
|
||||
public native var stylesheet: Stylesheet = js.noImpl
|
||||
public native var onblur: () -> Unit = js.noImpl
|
||||
public native var onclick: () -> Unit = js.noImpl
|
||||
public native var ondblclick: () -> Unit = js.noImpl
|
||||
public native var onfocus: () -> Unit = js.noImpl
|
||||
public native var onkeydown: () -> Unit = js.noImpl
|
||||
public native var onkeyup: () -> Unit = js.noImpl
|
||||
public native var onmouseup: () -> Unit = js.noImpl
|
||||
public native var onmousedown: () -> Unit = js.noImpl
|
||||
public native var onmouseout: () -> Unit = js.noImpl
|
||||
public native var onmouseover: () -> Unit = js.noImpl
|
||||
public native var onmousemove: () -> Unit = js.noImpl
|
||||
public native var onresize: () -> Unit = js.noImpl
|
||||
}
|
||||
|
||||
public native trait CSSStyleDeclaration {
|
||||
public native var cssText: String = js.noImpl
|
||||
public native var length: Double = js.noImpl
|
||||
public native var parentRule: CSSRule = js.noImpl
|
||||
public native fun getPropertyPriority(propertyName: String): String = js.noImpl
|
||||
public native fun getPropertyValue(propertyName: String): String = js.noImpl
|
||||
public native fun item(index: Number): String = js.noImpl
|
||||
public native fun removeProperty(propertyName: String): String = js.noImpl
|
||||
public native fun setProperty(propertyName: String, value: String, priority: String): Unit = js.noImpl
|
||||
}
|
||||
|
||||
public native trait HTMLHtmlElement : HTMLElement {
|
||||
public native var version: String = js.noImpl
|
||||
}
|
||||
|
||||
public native trait HTMLHeadElement : HTMLElement {
|
||||
public native var profile: String = js.noImpl
|
||||
}
|
||||
|
||||
public native trait HTMLLinkElement : HTMLElement {
|
||||
public native var disabled: Boolean = js.noImpl
|
||||
public native var charset: String = js.noImpl
|
||||
public native var href: String = js.noImpl
|
||||
public native var hreflang: String = js.noImpl
|
||||
public native var media: String = js.noImpl
|
||||
public native var rel: String = js.noImpl
|
||||
public native var rev: String = js.noImpl
|
||||
public native var target: String = js.noImpl
|
||||
public native var `type`: String = js.noImpl
|
||||
}
|
||||
|
||||
public native trait HTMLTitleElement : HTMLElement {
|
||||
public native var text: String = js.noImpl
|
||||
}
|
||||
|
||||
public native trait HTMLMetaElement : HTMLElement {
|
||||
public native var content: String = js.noImpl
|
||||
public native var httpEquiv: String = js.noImpl
|
||||
public native var name: String = js.noImpl
|
||||
public native var scheme: String = js.noImpl
|
||||
}
|
||||
|
||||
public native trait HTMLBaseElement : HTMLElement {
|
||||
public native var href: String = js.noImpl
|
||||
public native var target: String = js.noImpl
|
||||
}
|
||||
|
||||
public native trait HTMLIsIndexElement : HTMLElement {
|
||||
public native val form: HTMLFormElement = js.noImpl
|
||||
public native var prompt: String = js.noImpl
|
||||
}
|
||||
|
||||
public native trait HTMLStyleElement : HTMLElement {
|
||||
public native var disabled: Boolean = js.noImpl
|
||||
public native var media: String = js.noImpl
|
||||
public native var `type`: String = js.noImpl
|
||||
}
|
||||
|
||||
public native trait HTMLBodyElement : HTMLElement {
|
||||
public native var aLink: String = js.noImpl
|
||||
public native var background: String = js.noImpl
|
||||
public native var bgColor: String = js.noImpl
|
||||
public native var link: String = js.noImpl
|
||||
public native var text: String = js.noImpl
|
||||
public native var vLink: String = js.noImpl
|
||||
public native var onload: () -> Unit = js.noImpl
|
||||
public native var onunload: () -> Unit = js.noImpl
|
||||
}
|
||||
|
||||
public native trait HTMLFormElement {
|
||||
public native val elements: HTMLCollection = js.noImpl
|
||||
public native val length: Double = js.noImpl
|
||||
public native var name: String = js.noImpl
|
||||
public native var acceptCharset: String = js.noImpl
|
||||
public native var action: String = js.noImpl
|
||||
public native var enctype: String = js.noImpl
|
||||
public native var method: String = js.noImpl
|
||||
public native var target: String = js.noImpl
|
||||
public native fun submit(): Unit = js.noImpl
|
||||
public native fun reset(): Unit = js.noImpl
|
||||
}
|
||||
|
||||
public native trait HTMLSelectElement : HTMLElement {
|
||||
public native val `type`: String = js.noImpl
|
||||
public native var selectedIndex: Double = js.noImpl
|
||||
public native var value: String = js.noImpl
|
||||
public native var length: Double = js.noImpl
|
||||
public native val form: HTMLFormElement = js.noImpl
|
||||
public native val options: HTMLOptionsCollection = js.noImpl
|
||||
public native var disabled: Boolean = js.noImpl
|
||||
public native var multiple: Boolean = js.noImpl
|
||||
public native var name: String = js.noImpl
|
||||
public native var size: Double = js.noImpl
|
||||
public native var tabIndex: Double = js.noImpl
|
||||
public native fun add(element: HTMLElement, before: HTMLElement): Unit = js.noImpl
|
||||
public native fun remove(index: Number): Unit = js.noImpl
|
||||
public native fun blur(): Unit = js.noImpl
|
||||
public native fun focus(): Unit = js.noImpl
|
||||
}
|
||||
|
||||
public native trait HTMLOptGroupElement : HTMLElement {
|
||||
public native var disabled: Boolean = js.noImpl
|
||||
public native var label: String = js.noImpl
|
||||
}
|
||||
|
||||
public native trait HTMLOptionElement : HTMLElement {
|
||||
public native val form: HTMLFormElement = js.noImpl
|
||||
public native var defaultSelected: Boolean = js.noImpl
|
||||
public native var text: String = js.noImpl
|
||||
public native var index: Double = js.noImpl
|
||||
public native var disabled: Boolean = js.noImpl
|
||||
public native var label: String = js.noImpl
|
||||
public native var selected: Boolean = js.noImpl
|
||||
public native var value: String = js.noImpl
|
||||
}
|
||||
|
||||
public native trait HTMLInputElement : HTMLElement {
|
||||
public native var defaultValue: String = js.noImpl
|
||||
public native var defaultChecked: Boolean = js.noImpl
|
||||
public native val form: HTMLFormElement = js.noImpl
|
||||
public native var accept: String = js.noImpl
|
||||
public native var accessKey: String = js.noImpl
|
||||
public native var align: String = js.noImpl
|
||||
public native var alt: String = js.noImpl
|
||||
public native var checked: Boolean = js.noImpl
|
||||
public native var disabled: Boolean = js.noImpl
|
||||
public native var maxLength: Double = js.noImpl
|
||||
public native var name: String = js.noImpl
|
||||
public native var readOnly: Boolean = js.noImpl
|
||||
public native var size: Double = js.noImpl
|
||||
public native var src: String = js.noImpl
|
||||
public native var tabIndex: Double = js.noImpl
|
||||
public native var `type`: String = js.noImpl
|
||||
public native var useMap: String = js.noImpl
|
||||
public native var value: String = js.noImpl
|
||||
public native fun blur(): Unit = js.noImpl
|
||||
public native fun focus(): Unit = js.noImpl
|
||||
public native fun select(): Unit = js.noImpl
|
||||
public native fun click(): Unit = js.noImpl
|
||||
public native var selectionStart: Double = js.noImpl
|
||||
public native var selectionEnd: Double = js.noImpl
|
||||
}
|
||||
|
||||
public native trait HTMLTextAreaElement : HTMLElement {
|
||||
public native var defaultValue: String = js.noImpl
|
||||
public native val form: HTMLFormElement = js.noImpl
|
||||
public native var accessKey: String = js.noImpl
|
||||
public native var cols: Double = js.noImpl
|
||||
public native var disabled: Boolean = js.noImpl
|
||||
public native var name: String = js.noImpl
|
||||
public native var readOnly: Boolean = js.noImpl
|
||||
public native var rows: Double = js.noImpl
|
||||
public native var tabIndex: Double = js.noImpl
|
||||
public native var `type`: String = js.noImpl
|
||||
public native var value: String = js.noImpl
|
||||
public native fun blur(): Unit = js.noImpl
|
||||
public native fun focus(): Unit = js.noImpl
|
||||
public native fun select(): Unit = js.noImpl
|
||||
}
|
||||
|
||||
public native trait HTMLButtonElement : HTMLElement {
|
||||
public native val form: HTMLFormElement = js.noImpl
|
||||
public native var accessKey: String = js.noImpl
|
||||
public native var disabled: Boolean = js.noImpl
|
||||
public native var name: String = js.noImpl
|
||||
public native var tabIndex: Double = js.noImpl
|
||||
public native var `type`: String = js.noImpl
|
||||
public native var value: String = js.noImpl
|
||||
}
|
||||
|
||||
public native trait HTMLLabelElement : HTMLElement {
|
||||
public native val form: HTMLFormElement = js.noImpl
|
||||
public native var accessKey: String = js.noImpl
|
||||
public native var htmlFor: String = js.noImpl
|
||||
}
|
||||
|
||||
public native trait HTMLFieldSetElement : HTMLElement {
|
||||
public native val form: HTMLFormElement = js.noImpl
|
||||
}
|
||||
|
||||
public native trait HTMLLegendElement : HTMLElement {
|
||||
public native val form: HTMLFormElement = js.noImpl
|
||||
public native var accessKey: String = js.noImpl
|
||||
public native var align: String = js.noImpl
|
||||
}
|
||||
|
||||
public native trait HTMLUListElement : HTMLElement {
|
||||
public native var compact: Boolean = js.noImpl
|
||||
public native var `type`: String = js.noImpl
|
||||
}
|
||||
|
||||
public native trait HTMLOListElement : HTMLElement {
|
||||
public native var compact: Boolean = js.noImpl
|
||||
public native var start: Double = js.noImpl
|
||||
public native var `type`: String = js.noImpl
|
||||
}
|
||||
|
||||
public native trait HTMLDListElement : HTMLElement {
|
||||
public native var compact: Boolean = js.noImpl
|
||||
}
|
||||
|
||||
public native trait HTMLDirectoryElement : HTMLElement {
|
||||
public native var compact: Boolean = js.noImpl
|
||||
}
|
||||
|
||||
public native trait HTMLMenuElement : HTMLElement {
|
||||
public native var compact: Boolean = js.noImpl
|
||||
}
|
||||
|
||||
public native trait HTMLLIElement : HTMLElement {
|
||||
public native var `type`: String = js.noImpl
|
||||
public native var value: Double = js.noImpl
|
||||
}
|
||||
|
||||
public native trait HTMLDivElement : HTMLElement {
|
||||
public native var align: String = js.noImpl
|
||||
}
|
||||
|
||||
public native trait HTMLParagraphElement : HTMLElement {
|
||||
public native var align: String = js.noImpl
|
||||
}
|
||||
|
||||
public native trait HTMLHeadingElement : HTMLElement {
|
||||
public native var align: String = js.noImpl
|
||||
}
|
||||
|
||||
public native trait HTMLQuoteElement : HTMLElement {
|
||||
public native var cite: String = js.noImpl
|
||||
}
|
||||
|
||||
public native trait HTMLPreElement : HTMLElement {
|
||||
public native var width: Double = js.noImpl
|
||||
}
|
||||
|
||||
public native trait HTMLBRElement : HTMLElement {
|
||||
public native var clear: String = js.noImpl
|
||||
}
|
||||
|
||||
public native trait HTMLBaseFontElement : HTMLElement {
|
||||
public native var color: String = js.noImpl
|
||||
public native var face: String = js.noImpl
|
||||
public native var size: Double = js.noImpl
|
||||
}
|
||||
|
||||
public native trait HTMLFontElement : HTMLElement {
|
||||
public native var color: String = js.noImpl
|
||||
public native var face: String = js.noImpl
|
||||
public native var size: String = js.noImpl
|
||||
}
|
||||
|
||||
public native trait HTMLHRElement : HTMLElement {
|
||||
public native var align: String = js.noImpl
|
||||
public native var noShade: Boolean = js.noImpl
|
||||
public native var size: String = js.noImpl
|
||||
public native var width: String = js.noImpl
|
||||
}
|
||||
|
||||
public native trait HTMLModElement : HTMLElement {
|
||||
public native var cite: String = js.noImpl
|
||||
public native var dateTime: String = js.noImpl
|
||||
}
|
||||
|
||||
public native trait HTMLAnchorElement : HTMLElement {
|
||||
public native var accessKey: String = js.noImpl
|
||||
public native var charset: String = js.noImpl
|
||||
public native var coords: String = js.noImpl
|
||||
public native var href: String = js.noImpl
|
||||
public native var hreflang: String = js.noImpl
|
||||
public native var name: String = js.noImpl
|
||||
public native var rel: String = js.noImpl
|
||||
public native var rev: String = js.noImpl
|
||||
public native var shape: String = js.noImpl
|
||||
public native var tabIndex: Double = js.noImpl
|
||||
public native var target: String = js.noImpl
|
||||
public native var `type`: String = js.noImpl
|
||||
public native fun blur(): Unit = js.noImpl
|
||||
public native fun focus(): Unit = js.noImpl
|
||||
}
|
||||
|
||||
public native trait HTMLImageElement : HTMLElement {
|
||||
public native var name: String = js.noImpl
|
||||
public native var align: String = js.noImpl
|
||||
public native var alt: String = js.noImpl
|
||||
public native var border: String = js.noImpl
|
||||
public native var height: Double = js.noImpl
|
||||
public native var hspace: Double = js.noImpl
|
||||
public native var isMap: Boolean = js.noImpl
|
||||
public native var longDesc: String = js.noImpl
|
||||
public native var src: String = js.noImpl
|
||||
public native var useMap: String = js.noImpl
|
||||
public native var vspace: Double = js.noImpl
|
||||
public native var width: Double = js.noImpl
|
||||
}
|
||||
|
||||
public native trait HTMLObjectElement : HTMLElement {
|
||||
public native val form: HTMLFormElement = js.noImpl
|
||||
public native var code: String = js.noImpl
|
||||
public native var align: String = js.noImpl
|
||||
public native var archive: String = js.noImpl
|
||||
public native var border: String = js.noImpl
|
||||
public native var codeBase: String = js.noImpl
|
||||
public native var codeType: String = js.noImpl
|
||||
public native var data: String = js.noImpl
|
||||
public native var declare: Boolean = js.noImpl
|
||||
public native var height: String = js.noImpl
|
||||
public native var hspace: Double = js.noImpl
|
||||
public native var name: String = js.noImpl
|
||||
public native var standby: String = js.noImpl
|
||||
public native var tabIndex: Double = js.noImpl
|
||||
public native var `type`: String = js.noImpl
|
||||
public native var useMap: String = js.noImpl
|
||||
public native var vspace: Double = js.noImpl
|
||||
public native var width: String = js.noImpl
|
||||
public native val contentDocument: Document = js.noImpl
|
||||
}
|
||||
|
||||
public native trait HTMLParamElement : HTMLElement {
|
||||
public native var name: String = js.noImpl
|
||||
public native var `type`: String = js.noImpl
|
||||
public native var value: String = js.noImpl
|
||||
public native var valueType: String = js.noImpl
|
||||
}
|
||||
|
||||
public native trait HTMLAppletElement : HTMLElement {
|
||||
public native var align: String = js.noImpl
|
||||
public native var alt: String = js.noImpl
|
||||
public native var archive: String = js.noImpl
|
||||
public native var code: String = js.noImpl
|
||||
public native var codeBase: String = js.noImpl
|
||||
public native var height: String = js.noImpl
|
||||
public native var hspace: Double = js.noImpl
|
||||
public native var name: String = js.noImpl
|
||||
public native var `object`: String = js.noImpl
|
||||
public native var vspace: Double = js.noImpl
|
||||
public native var width: String = js.noImpl
|
||||
}
|
||||
|
||||
public native trait HTMLMapElement : HTMLElement {
|
||||
public native val areas: HTMLCollection = js.noImpl
|
||||
public native var name: String = js.noImpl
|
||||
}
|
||||
|
||||
public native trait HTMLAreaElement : HTMLElement {
|
||||
public native var accessKey: String = js.noImpl
|
||||
public native var alt: String = js.noImpl
|
||||
public native var coords: String = js.noImpl
|
||||
public native var href: String = js.noImpl
|
||||
public native var noHref: Boolean = js.noImpl
|
||||
public native var shape: String = js.noImpl
|
||||
public native var tabIndex: Double = js.noImpl
|
||||
public native var target: String = js.noImpl
|
||||
}
|
||||
|
||||
public native trait HTMLScriptElement : HTMLElement {
|
||||
public native var text: String = js.noImpl
|
||||
public native var htmlFor: String = js.noImpl
|
||||
public native var event: String = js.noImpl
|
||||
public native var charset: String = js.noImpl
|
||||
public native var defer: Boolean = js.noImpl
|
||||
public native var src: String = js.noImpl
|
||||
public native var `type`: String = js.noImpl
|
||||
}
|
||||
|
||||
public native trait HTMLTableElement : HTMLElement {
|
||||
public native var caption: HTMLTableCaptionElement = js.noImpl
|
||||
public native var tHead: HTMLTableSectionElement = js.noImpl
|
||||
public native var tFoot: HTMLTableSectionElement = js.noImpl
|
||||
public native val rows: HTMLCollection = js.noImpl
|
||||
public native val tBodies: HTMLCollection = js.noImpl
|
||||
public native var align: String = js.noImpl
|
||||
public native var bgColor: String = js.noImpl
|
||||
public native var border: String = js.noImpl
|
||||
public native var cellPadding: String = js.noImpl
|
||||
public native var cellSpacing: String = js.noImpl
|
||||
public native var frame: String = js.noImpl
|
||||
public native var rules: String = js.noImpl
|
||||
public native var summary: String = js.noImpl
|
||||
public native var width: String = js.noImpl
|
||||
public native fun createTHead(): HTMLElement? = js.noImpl
|
||||
public native fun deleteTHead(): Unit = js.noImpl
|
||||
public native fun createTFoot(): HTMLElement? = js.noImpl
|
||||
public native fun deleteTFoot(): Unit = js.noImpl
|
||||
public native fun createCaption(): HTMLElement? = js.noImpl
|
||||
public native fun deleteCaption(): Unit = js.noImpl
|
||||
public native fun insertRow(index: Number): HTMLElement? = js.noImpl
|
||||
public native fun deleteRow(index: Number): Unit = js.noImpl
|
||||
}
|
||||
|
||||
public native trait HTMLTableCaptionElement : HTMLElement {
|
||||
public native var align: String = js.noImpl
|
||||
}
|
||||
|
||||
public native trait HTMLTableColElement : HTMLElement {
|
||||
public native var align: String = js.noImpl
|
||||
public native var ch: String = js.noImpl
|
||||
public native var chOff: String = js.noImpl
|
||||
public native var span: Double = js.noImpl
|
||||
public native var vAlign: String = js.noImpl
|
||||
public native var width: String = js.noImpl
|
||||
}
|
||||
|
||||
public native trait HTMLTableSectionElement : HTMLElement {
|
||||
public native var align: String = js.noImpl
|
||||
public native var ch: String = js.noImpl
|
||||
public native var chOff: String = js.noImpl
|
||||
public native var vAlign: String = js.noImpl
|
||||
public native val rows: HTMLCollection = js.noImpl
|
||||
public native fun insertRow(index: Number): HTMLElement? = js.noImpl
|
||||
public native fun deleteRow(index: Number): Unit = js.noImpl
|
||||
}
|
||||
|
||||
public native trait HTMLTableRowElement : HTMLElement {
|
||||
public native val rowIndex: Double = js.noImpl
|
||||
public native val sectionRowIndex: Double = js.noImpl
|
||||
public native val cells: HTMLCollection = js.noImpl
|
||||
public native var align: String = js.noImpl
|
||||
public native var bgColor: String = js.noImpl
|
||||
public native var ch: String = js.noImpl
|
||||
public native var chOff: String = js.noImpl
|
||||
public native var vAlign: String = js.noImpl
|
||||
public native fun insertCell(index: Number): HTMLElement? = js.noImpl
|
||||
public native fun deleteCell(index: Number): Unit = js.noImpl
|
||||
}
|
||||
|
||||
public native trait HTMLTableCellElement : HTMLElement {
|
||||
public native val cellIndex: Double = js.noImpl
|
||||
public native var abbr: String = js.noImpl
|
||||
public native var align: String = js.noImpl
|
||||
public native var axis: String = js.noImpl
|
||||
public native var bgColor: String = js.noImpl
|
||||
public native var ch: String = js.noImpl
|
||||
public native var chOff: String = js.noImpl
|
||||
public native var colSpan: Double = js.noImpl
|
||||
public native var headers: String = js.noImpl
|
||||
public native var height: String = js.noImpl
|
||||
public native var noWrap: Boolean = js.noImpl
|
||||
public native var rowSpan: Double = js.noImpl
|
||||
public native var scope: String = js.noImpl
|
||||
public native var vAlign: String = js.noImpl
|
||||
public native var width: String = js.noImpl
|
||||
}
|
||||
|
||||
public native trait HTMLFrameSetElement : HTMLElement {
|
||||
public native var cols: String = js.noImpl
|
||||
public native var rows: String = js.noImpl
|
||||
}
|
||||
|
||||
public native trait HTMLFrameElement : HTMLElement {
|
||||
public native var frameBorder: String = js.noImpl
|
||||
public native var longDesc: String = js.noImpl
|
||||
public native var marginHeight: String = js.noImpl
|
||||
public native var marginWidth: String = js.noImpl
|
||||
public native var name: String = js.noImpl
|
||||
public native var noResize: Boolean = js.noImpl
|
||||
public native var scrolling: String = js.noImpl
|
||||
public native var src: String = js.noImpl
|
||||
}
|
||||
|
||||
public native trait HTMLIFrameElement : HTMLElement {
|
||||
public native var align: String = js.noImpl
|
||||
public native var frameBorder: String = js.noImpl
|
||||
public native var height: String = js.noImpl
|
||||
public native var longDesc: String = js.noImpl
|
||||
public native var marginHeight: String = js.noImpl
|
||||
public native var marginWidth: String = js.noImpl
|
||||
public native var name: String = js.noImpl
|
||||
public native var scrolling: String = js.noImpl
|
||||
public native var src: String = js.noImpl
|
||||
public native var width: String = js.noImpl
|
||||
public native val contentDocument: Document = js.noImpl
|
||||
public native val contentWindow: Window = js.noImpl
|
||||
}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
package js.dom.html
|
||||
|
||||
import js.noImpl
|
||||
|
||||
native
|
||||
val window : Window = js.noImpl
|
||||
@@ -0,0 +1,89 @@
|
||||
package js.dom.html5
|
||||
|
||||
import js.native
|
||||
import js.noImpl
|
||||
import js.dom.html.HTMLElement
|
||||
import js.dom.core.Element
|
||||
|
||||
public native trait HTMLImageElement {
|
||||
public native var crossOrigin: String = js.noImpl
|
||||
}
|
||||
|
||||
public native trait HTMLCanvasElement : HTMLElement {
|
||||
public native var width: Double = js.noImpl
|
||||
public native var height: Double = js.noImpl
|
||||
public native fun getContext(context: String): CanvasContext? = js.noImpl
|
||||
public native fun toDataURL(string: String, args: Any): String = js.noImpl
|
||||
}
|
||||
|
||||
public native trait CanvasContext {
|
||||
public native var canvas: HTMLCanvasElement = js.noImpl
|
||||
public native fun save(): Unit = js.noImpl
|
||||
public native fun restore(): Unit = js.noImpl
|
||||
public native fun scale(x: Number, y: Number): Unit = js.noImpl
|
||||
public native fun rotate(angle: Number): Unit = js.noImpl
|
||||
public native fun translate(x: Number, y: Number): Unit = js.noImpl
|
||||
public native fun transform(m11: Number, m12: Number, m21: Number, m22: Number, dx: Number, dy: Number): Unit = js.noImpl
|
||||
public native fun setTransform(m11: Number, m12: Number, m21: Number, m22: Number, dx: Number, dy: Number): Unit = js.noImpl
|
||||
public native var globalAlpha: Double = js.noImpl
|
||||
public native var globalCompositeOperation: String = js.noImpl
|
||||
public native var fillStyle: String = js.noImpl
|
||||
public native var strokeStyle: String = js.noImpl
|
||||
public native fun createLinearGradient(x0: Number, y0: Number, x1: Number, y1: Number): CanvasGradient? = js.noImpl
|
||||
public native fun createRadialGradient(x0: Number, y0: Number, r0: Number, x1: Number, y1: Number, r1: Number): CanvasGradient? = js.noImpl
|
||||
public native var lineWidth: Double = js.noImpl
|
||||
public native var lineCap: String = js.noImpl
|
||||
public native var lineJoin: String = js.noImpl
|
||||
public native var miterLimit: Double = js.noImpl
|
||||
public native var shadowOffsetX: Double = js.noImpl
|
||||
public native var shadowOffsetY: Double = js.noImpl
|
||||
public native var shadowBlur: Double = js.noImpl
|
||||
public native var shadowColor: String = js.noImpl
|
||||
public native fun clearRect(x: Number, y: Number, w: Number, h: Number): Unit = js.noImpl
|
||||
public native fun fillRect(x: Number, y: Number, w: Number, h: Number): Unit = js.noImpl
|
||||
public native fun strokeRect(x: Number, y: Number, w: Number, h: Number): Unit = js.noImpl
|
||||
public native fun beginPath(): Unit = js.noImpl
|
||||
public native fun closePath(): Unit = js.noImpl
|
||||
public native fun moveTo(x: Number, y: Number): Unit = js.noImpl
|
||||
public native fun lineTo(x: Number, y: Number): Unit = js.noImpl
|
||||
public native fun quadraticCurveTo(cpx: Number, cpy: Number, x: Number, y: Number): Unit = js.noImpl
|
||||
public native fun bezierCurveTo(cp1x: Number, cp1y: Number, cp2x: Number, cp2y: Number, x: Number, y: Number): Unit = js.noImpl
|
||||
public native fun arcTo(x1: Number, y1: Number, x2: Number, y2: Number, radius: Number): Unit = js.noImpl
|
||||
public native fun rect(x: Number, y: Number, w: Number, h: Number): Unit = js.noImpl
|
||||
public native fun arc(x: Number, y: Number, radius: Number, startAngle: Number, endAngle: Number, anticlockwise: Boolean): Unit = js.noImpl
|
||||
public native fun fill(): Unit = js.noImpl
|
||||
public native fun stroke(): Unit = js.noImpl
|
||||
public native fun clip(): Unit = js.noImpl
|
||||
public native fun isPointInPath(x: Number, y: Number): Boolean = js.noImpl
|
||||
public native fun drawFocusRing(element: Element, xCaret: Number, yCaret: Number, canDrawCustom: Boolean): Unit = js.noImpl
|
||||
public native var font: String = js.noImpl
|
||||
public native var textAlign: String = js.noImpl
|
||||
public native var textBaseline: String = js.noImpl
|
||||
public native fun fillText(text: String, x: Number, y: Number, maxWidth: Number): Unit = js.noImpl
|
||||
public native fun strokeText(text: String, x: Number, y: Number, maxWidth: Number): Unit = js.noImpl
|
||||
public native fun measureText(text: String): TextMetrics? = js.noImpl
|
||||
public native fun drawImage(img_elem: HTMLElement, dx_or_sx: Number, dy_or_sy: Number, dw_or_sw: Number, dh_or_sh: Number, dx: Number, dy: Number, dw: Number, dh: Number): Unit = js.noImpl
|
||||
public native fun createImageData(imagedata: ImageData, sh: Number): ImageData? = js.noImpl
|
||||
public native fun createImageData(sw: Number, sh: Number): ImageData? = js.noImpl
|
||||
public native fun getImageData(sx: Number, sy: Number, sw: Number, sh: Number): ImageData? = js.noImpl
|
||||
public native fun putImageData(image_data: ImageData, dx: Number, dy: Number, dirtyX: Number, dirtyY: Number, dirtyWidth: Number, dirtyHeight: Number): Unit = js.noImpl
|
||||
}
|
||||
|
||||
public native trait CanvasGradient {
|
||||
public native fun addColorStop(offset: Number, color: String): Unit = js.noImpl
|
||||
}
|
||||
|
||||
public native trait ImageData {
|
||||
public native var data: CanvasPixelArray = js.noImpl
|
||||
public native var width: Double = js.noImpl
|
||||
public native var height: Double = js.noImpl
|
||||
}
|
||||
|
||||
public native trait CanvasPixelArray {
|
||||
public native var length: Double = js.noImpl
|
||||
}
|
||||
|
||||
public native trait TextMetrics {
|
||||
public native var width: Double = js.noImpl
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ public final class WebDemoCanvasExamplesTest extends SingleFileTranslationTest {
|
||||
}
|
||||
|
||||
public void testFancyLines() throws Exception {
|
||||
doTest("Fancy lines.kt", "$");
|
||||
doTest("Fancy lines.kt", "window");
|
||||
}
|
||||
|
||||
public void testTrafficLight() throws Exception {
|
||||
|
||||
@@ -62,14 +62,13 @@ public abstract class Config {
|
||||
"/core/math.kt",
|
||||
"/core/json.kt",
|
||||
"/raphael/raphael.kt",
|
||||
"/html5/canvas.kt",
|
||||
"/html5/files.kt",
|
||||
"/html5/image.kt",
|
||||
"/stdlib/JUMaps.kt",
|
||||
"/stdlib/browser.kt",
|
||||
"/core/dom.kt"
|
||||
// TODO
|
||||
// "/core/dom/core.kt"
|
||||
"/core/dom.kt",
|
||||
"/dom/domcore.kt",
|
||||
"/dom/html/htmlcore.kt",
|
||||
"/dom/html/window.kt",
|
||||
"/dom/html5/canvas.kt"
|
||||
);
|
||||
|
||||
public static final String LIBRARIES_LOCATION = "js/js.libraries/src";
|
||||
|
||||
@@ -6,59 +6,61 @@ Note that only a subset of the api is supported for now.
|
||||
|
||||
package fancylines
|
||||
|
||||
import js.*;
|
||||
import html5.*;
|
||||
import jquery.*;
|
||||
import js.dom.html5.*
|
||||
import js.dom.html.window
|
||||
|
||||
fun main(args : Array<String>) {
|
||||
//jq is a name for JQuery function
|
||||
jq {
|
||||
FancyLines().run();
|
||||
}
|
||||
fun main(args: Array<String>) {
|
||||
window.onload = {
|
||||
FancyLines().run()
|
||||
}
|
||||
}
|
||||
|
||||
val canvas: HTMLCanvasElement
|
||||
get() {
|
||||
return window.document.getElementsByTagName("canvas").item(0) as HTMLCanvasElement
|
||||
}
|
||||
|
||||
class FancyLines() {
|
||||
// we use two 'magic' functions here getContext() and getCanvas()
|
||||
val context = getContext();
|
||||
val height = getCanvas().height;
|
||||
val width = getCanvas().width;
|
||||
var x = width * Math.random();
|
||||
var y = height * Math.random();
|
||||
var hue = 0;
|
||||
val context = canvas.getContext("2d")!!
|
||||
val height = canvas.height
|
||||
val width = canvas.width
|
||||
var x = width * Math.random()
|
||||
var y = height * Math.random()
|
||||
var hue = 0;
|
||||
|
||||
fun line() {
|
||||
context.save();
|
||||
fun line() {
|
||||
context.save()
|
||||
|
||||
context.beginPath();
|
||||
context.beginPath()
|
||||
|
||||
context.lineWidth = 20.0 * Math.random();
|
||||
context.moveTo(x.toInt(), y.toInt());
|
||||
context.lineWidth = 20.0 * Math.random()
|
||||
context.moveTo(x.toInt(), y.toInt());
|
||||
|
||||
x = width * Math.random();
|
||||
y = height * Math.random();
|
||||
x = width * Math.random();
|
||||
y = height * Math.random()
|
||||
|
||||
context.bezierCurveTo(width * Math.random(), height * Math.random(),
|
||||
width * Math.random(), height * Math.random(), x, y);
|
||||
context.bezierCurveTo(width * Math.random(), height * Math.random(),
|
||||
width * Math.random(), height * Math.random(), x, y);
|
||||
|
||||
hue += Math.random() * 10;
|
||||
hue += Math.random() * 10;
|
||||
|
||||
context.strokeStyle = "hsl($hue, 50%, 50%)";
|
||||
context.strokeStyle = "hsl($hue, 50%, 50%)";
|
||||
|
||||
context.shadowColor = "white";
|
||||
context.shadowBlur = 10.0;
|
||||
context.shadowColor = "white";
|
||||
context.shadowBlur = 10.0;
|
||||
|
||||
context.stroke();
|
||||
context.stroke();
|
||||
|
||||
context.restore();
|
||||
}
|
||||
context.restore();
|
||||
}
|
||||
|
||||
fun blank() {
|
||||
context.fillStyle = "rgba(255,255,1,0.1)";
|
||||
context.fillRect(0, 0, width, height);
|
||||
}
|
||||
fun blank() {
|
||||
context.fillStyle = "rgba(255,255,1,0.1)";
|
||||
context.fillRect(0, 0, width, height);
|
||||
}
|
||||
|
||||
fun run() {
|
||||
setInterval({line()}, 40);
|
||||
setInterval({blank()}, 100);
|
||||
}
|
||||
fun run() {
|
||||
setInterval({line()}, 40);
|
||||
setInterval({blank()}, 100);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user