static public void FadeOutCollapse(this IHTMLElement target, int waittime, int fadetime, Action done) { target.FadeOut(waittime, fadetime, delegate { if (done != null) { done(); } if (target != null) { (fadetime / 25).AtInterval( t => { var h = target.clientHeight; if (h > 6) { target.style.height = (h - 6) + "px"; } else { target.Orphanize(); t.Stop(); } } ); } } ); }
//async Task __buttryfly() //{ // //Task.Factory. //} //async void Spawn(IHTMLElement e) { Native.Document.body.style.margin = "0px"; Native.Document.body.style.padding = "0px"; Native.Document.body.style.overflow = IStyle.OverflowEnum.hidden; e.style.position = IStyle.PositionEnum.absolute; e.style.left = "0px"; e.style.top = "0px"; e.style.right = "0px"; e.style.bottom = "0px"; e.style.backgroundColor = Color.FromRGB(209, 245, 245); IHTMLElement loading = new IHTMLElement(IHTMLElement.HTMLElementEnum.code, "loading..."); loading.style.SetLocation(64, 64, 200, 64); e.appendChild(loading); //await __buttryfly(); new global::ButterFly.HTML.Images.FromAssets.buttryfly().InvokeOnComplete( img => { loading.FadeOut(); try { //IStyleSheet.Default.AddRule("*", "cursor: none, url('" + new global::ButterFly.HTML.Images.FromAssets.nocursor().src + "'), auto;", 0); IStyleSheet.Default.AddRule("*", "cursor: none;", 0); } catch (Exception exc) { new IHTMLElement(IHTMLElement.HTMLElementEnum.pre, exc.Message).AttachToDocument(); } e.style.backgroundImage = "url(" + img.src + ")"; e.style.backgroundRepeat = "no-repeat"; e.DisableContextMenu(); var x = 0; var y = 0; Action update = delegate { e.style.backgroundPosition = x + "px " + y + "px"; }; e.onmousemove += delegate(IEvent i) { #region where is the cursor? if (Native.Document.pointerLockElement == e) { x += i.movementX; y += i.movementY; } else { x = i.CursorX; y = i.CursorY; } if (x < -img.width / 2) x += Native.window.Width; if (y < -img.height / 2) y += Native.window.Height; x = x % Native.window.Width; y = y % Native.window.Height; #endregion update(); }; e.onclick += delegate { e.requestPointerLock(); }; }); }
//async Task __buttryfly() //{ // //Task.Factory. //} //async void Spawn(IHTMLElement e) { Native.Document.body.style.margin = "0px"; Native.Document.body.style.padding = "0px"; Native.Document.body.style.overflow = IStyle.OverflowEnum.hidden; e.style.position = IStyle.PositionEnum.absolute; e.style.left = "0px"; e.style.top = "0px"; e.style.right = "0px"; e.style.bottom = "0px"; e.style.backgroundColor = Color.FromRGB(209, 245, 245); IHTMLElement loading = new IHTMLElement(IHTMLElement.HTMLElementEnum.code, "loading..."); loading.style.SetLocation(64, 64, 200, 64); e.appendChild(loading); //await __buttryfly(); new global::ButterFlyWithInteractiveInt32Offset.HTML.Images.FromAssets.buttryfly().InvokeOnComplete( img => { loading.FadeOut(); try { //IStyleSheet.Default.AddRule("*", "cursor: none, url('" + new global::ButterFlyWithInteractiveInt32Offset.HTML.Images.FromAssets.nocursor().src + "'), auto;", 0); //IStyleSheet.Default.AddRule("*", "cursor: none;", 0); } catch (Exception exc) { new IHTMLElement(IHTMLElement.HTMLElementEnum.pre, exc.Message).AttachToDocument(); } e.style.backgroundImage = "url(" + img.src + ")"; e.style.backgroundRepeat = "no-repeat"; e.DisableContextMenu(); var x = 0; var y = 0; var overlay = new IHTMLDiv(); overlay.style.border = "1px solid red"; overlay.style.SetSize(64, 64); overlay.AttachToDocument(); Native.window.onframe += delegate { e.style.backgroundPosition = x + "px " + y + "px"; overlay.style.SetLocation( // how does this work with the background compiler? // once browser clicks save, visual studio asks if // to accept, and bacground compiler // starts a new compilation // so, the running app could first be able // to inspect, whats new? // and if only the same constant was changed, // it can be discarded. same with comments. x + 67.ToInteractiveInt32Form(), y + 2.ToInteractiveInt32Form() ); }; e.onmousemove += delegate(IEvent i) { #region where is the cursor? if (Native.Document.pointerLockElement == e) { x += i.movementX; y += i.movementY; } else { x = i.CursorX; y = i.CursorY; } if (x < -img.width / 2) x += Native.window.Width; if (y < -img.height / 2) y += Native.window.Height; x = x % Native.window.Width; y = y % Native.window.Height; #endregion }; e.onclick += delegate { e.requestPointerLock(); }; }); }
//async Task __buttryfly() //{ // //Task.Factory. //} //async void Spawn(IHTMLElement e) { Native.Document.body.style.margin = "0px"; Native.Document.body.style.padding = "0px"; Native.Document.body.style.overflow = IStyle.OverflowEnum.hidden; e.style.position = IStyle.PositionEnum.absolute; e.style.left = "0px"; e.style.top = "0px"; e.style.right = "0px"; e.style.bottom = "0px"; e.style.backgroundColor = Color.FromRGB(209, 245, 245); IHTMLElement loading = new IHTMLElement(IHTMLElement.HTMLElementEnum.code, "loading..."); loading.style.SetLocation(64, 64, 200, 64); e.appendChild(loading); //await __buttryfly(); new global::ButterFlyWithInteractiveInt32Offset.HTML.Images.FromAssets.buttryfly().InvokeOnComplete( img => { loading.FadeOut(); try { //IStyleSheet.Default.AddRule("*", "cursor: none, url('" + new global::ButterFlyWithInteractiveInt32Offset.HTML.Images.FromAssets.nocursor().src + "'), auto;", 0); //IStyleSheet.Default.AddRule("*", "cursor: none;", 0); } catch (Exception exc) { new IHTMLElement(IHTMLElement.HTMLElementEnum.pre, exc.Message).AttachToDocument(); } e.style.backgroundImage = "url(" + img.src + ")"; e.style.backgroundRepeat = "no-repeat"; e.DisableContextMenu(); var x = 0; var y = 0; var overlay = new IHTMLDiv(); overlay.style.border = "1px solid red"; overlay.style.SetSize(64, 64); overlay.AttachToDocument(); Native.window.onframe += delegate { e.style.backgroundPosition = x + "px " + y + "px"; overlay.style.SetLocation( // how does this work with the background compiler? // once browser clicks save, visual studio asks if // to accept, and bacground compiler // starts a new compilation // so, the running app could first be able // to inspect, whats new? // and if only the same constant was changed, // it can be discarded. same with comments. x + 67.ToInteractiveInt32Form(), y + 2.ToInteractiveInt32Form() ); }; e.onmousemove += delegate(IEvent i) { #region where is the cursor? if (Native.Document.pointerLockElement == e) { x += i.movementX; y += i.movementY; } else { x = i.CursorX; y = i.CursorY; } if (x < -img.width / 2) { x += Native.window.Width; } if (y < -img.height / 2) { y += Native.window.Height; } x = x % Native.window.Width; y = y % Native.window.Height; #endregion }; e.onclick += delegate { e.requestPointerLock(); }; }); }
//async Task __buttryfly() //{ // //Task.Factory. //} //async void Spawn(IHTMLElement e) { Native.Document.body.style.margin = "0px"; Native.Document.body.style.padding = "0px"; Native.Document.body.style.overflow = IStyle.OverflowEnum.hidden; e.style.position = IStyle.PositionEnum.absolute; e.style.left = "0px"; e.style.top = "0px"; e.style.right = "0px"; e.style.bottom = "0px"; e.style.backgroundColor = Color.FromRGB(209, 245, 245); IHTMLElement loading = new IHTMLElement(IHTMLElement.HTMLElementEnum.code, "loading..."); loading.style.SetLocation(64, 64, 200, 64); e.appendChild(loading); //await __buttryfly(); new global::ButterFly.HTML.Images.FromAssets.buttryfly().InvokeOnComplete( img => { loading.FadeOut(); try { //IStyleSheet.Default.AddRule("*", "cursor: none, url('" + new global::ButterFly.HTML.Images.FromAssets.nocursor().src + "'), auto;", 0); IStyleSheet.Default.AddRule("*", "cursor: none;", 0); } catch (Exception exc) { new IHTMLElement(IHTMLElement.HTMLElementEnum.pre, exc.Message).AttachToDocument(); } e.style.backgroundImage = "url(" + img.src + ")"; e.style.backgroundRepeat = "no-repeat"; e.DisableContextMenu(); var x = 0; var y = 0; Action update = delegate { e.style.backgroundPosition = x + "px " + y + "px"; }; e.onmousemove += delegate(IEvent i) { #region where is the cursor? if (Native.Document.pointerLockElement == e) { x += i.movementX; y += i.movementY; } else { x = i.CursorX; y = i.CursorY; } if (x < -img.width / 2) { x += Native.window.Width; } if (y < -img.height / 2) { y += Native.window.Height; } x = x % Native.window.Width; y = y % Native.window.Height; #endregion update(); }; e.onclick += delegate { e.requestPointerLock(); }; }); }