transform

How to do perspective view with html5 canvas

China☆狼群 提交于 2019-12-19 07:28:26
问题 I would like to make an image into skewed/perspective/rotated in html5 canvas. The image below is exactly what I would want to do. I have this code to use transformations in canvas but I cant make heads or tails with it. Could someone help me? Also I only want this to be done in HTML5 Canvas not css. var cs = Math.cos(angle1), sn = Math.sin(angle1); var h = Math.cos(angle2); var a = 100*cs, b = -100*sn, c = 200; var d = h*100*sn, e = h*100*cs, f = 200; ctx.setTransform(a, d, b, e, c, f); 回答1:

Change IPv4 to IPv6 string

南笙酒味 提交于 2019-12-19 07:23:12
问题 Sander Steffann mentioned in a previous question of mine: Addresses like 0000:0000:0000:0000:0000:0000:192.168.0.1 are written as 0000:0000:0000:0000:0000:0000:c0a8:0001 which is exactly the same address but in hex notation. How do I detect in PHP if an address was written like eg.: ::0000:192.168.0.1 or 0000::0000:192.168.0.1 or 0000:0000:0000:0000:0000:0000:192.168.0.1 etc.? Is it enough to check if an IP-based string has '.' AND ':' ? And how do I change this to the full string 0000:0000

Change IPv4 to IPv6 string

ε祈祈猫儿з 提交于 2019-12-19 07:23:10
问题 Sander Steffann mentioned in a previous question of mine: Addresses like 0000:0000:0000:0000:0000:0000:192.168.0.1 are written as 0000:0000:0000:0000:0000:0000:c0a8:0001 which is exactly the same address but in hex notation. How do I detect in PHP if an address was written like eg.: ::0000:192.168.0.1 or 0000::0000:192.168.0.1 or 0000:0000:0000:0000:0000:0000:192.168.0.1 etc.? Is it enough to check if an IP-based string has '.' AND ':' ? And how do I change this to the full string 0000:0000

css 动画库 Animate.css 使用

孤街浪徒 提交于 2019-12-19 05:43:35
1.css动画可以增加页面的趣味性,搞点动态的效果。这里就要提到一个非常好用的css动画库 Animate.css了。一些常用的 飞入飞出,跳动啊等等,自己去网站试试吧: http://www.jq22.com/yanshi819 2.使用方法 引入css库:<link rel="stylesheet" href="css/animate.min.css"></link> 如果你想让那个元素有动画效果,只需要如下使用:添加对应的类 <image src="images/index9/lianxi.png" class="animated c1 fadeInDown" /> 简单介绍一下类名的用处: animated:是动画的标识,必选; c1: 我定义的只运行一次,当然你也可以一直播放,那就用 " infinite " . animated.infinite { -webkit-animation-iteration-count: infinite; animation-iteration-count: infinite; } .animated.c1 { -webkit-animation-iteration-count: 1; animation-iteration-count: 1; } fadeInDown: 是动画的方式,飞入从上面掉下来;下面有很多,可以去npm看api

Changing width/height moves rotated element

一笑奈何 提交于 2019-12-19 04:44:33
问题 When changing the width/height of a rotated elements, the element moves! Here's an example JSFiddle When I change the width for example, the object loses its original position, this is effecting jQueryUI Resizable and making it unusable. CSS: .test{ position: absolute; top: 200px; left; 200px; width: 400px; height: 200px; background: red; transform: rotate(-90deg); } JSFiddle Is there a library or a function that corrects this issue by reversing this effect. Edit: I made a jQuery function

Changing width/height moves rotated element

半城伤御伤魂 提交于 2019-12-19 04:43:27
问题 When changing the width/height of a rotated elements, the element moves! Here's an example JSFiddle When I change the width for example, the object loses its original position, this is effecting jQueryUI Resizable and making it unusable. CSS: .test{ position: absolute; top: 200px; left; 200px; width: 400px; height: 200px; background: red; transform: rotate(-90deg); } JSFiddle Is there a library or a function that corrects this issue by reversing this effect. Edit: I made a jQuery function

装饰模式(包装模式)

旧城冷巷雨未停 提交于 2019-12-19 04:22:04
模式动机 一般有两种方式可以实现给一个类或对象增加行为: • 继承机制,使用继承机制是给现有类添加功能的一种有效途径,通过继承一个现有类可以使得子类在拥有自身方法的同时还拥有父类的方法。但是这种方法是静态的,用户不能控制增加行为的方式和时机。 • 关联机制,即将一个类的对象嵌入另一个对象中,由另一个对象来决定是否调用嵌入对象的行为以便扩展自己的行为,我们称这个嵌入的对象为装饰器(Decorator)。 装饰模式以对客户透明的方式动态地给一个对象附加上更多的责任,换言之,客户端并不会觉得对象在装饰前和装饰后有什么不同。装饰模式可以在不需要创造更多子类的情况下,将对象的功能加以扩展。这就是装饰模式的模式动机。 模式定义 装饰模式(Decorator Pattern) :动态地给一个对象增加一些额外的职责(Responsibility),就增加对象功能来说,装饰模式比生成子类实现更为灵活。其别名也可以称为包装器(Wrapper),与适配器模式的别名相同,但它们适用于不同的场合。根据翻译的不同,装饰模式也有人称之为“油漆工模式”,它是一种对象结构型模式。 模式结构 装饰模式包含如下角色: • Component : 抽象构件 • ConcreteComponent : 具体构件 • Decorator : 抽象装饰类 • ConcreteDecorator : 具体装饰类 模式分析

iPhone - How to transform an iPhone only app to universal app?

馋奶兔 提交于 2019-12-19 04:12:10
问题 how can i transform an iPhone only app to an universal application? EDIT : FOUND SOLUTION If you want to have the "Upgrade current target to iPad" option selected, you must have Target Device Family set to iPhone only, not iPad/iPhone. It works for me! 回答1: "The first step is to select your target in Xcode, right-click and use the “Upgrade Current Target for iPad…” command. You will presented with a choice: Select “One Universal application” and Xcode will do (some) of the hard work for us.

Since moving to java 1.7 Xml Document Element does not indent

那年仲夏 提交于 2019-12-19 02:52:10
问题 I'm trying to indent XML which generated by Transformer. All the DOM Node are being Indent as expected except for the First Node - The Document Element. document element does not start in a new line , just concat right after the XML Declaration. This bug arise when I moved to java 1.7 , when using java 1.6 or 1.5 it does not happen. My code : ByteArrayOutputStream s = new OutputStreamWriter(out, "utf-8"); TransformerFactory tf = TransformerFactory.newInstance(); Transformer transformer = tf

square to trapezoid

强颜欢笑 提交于 2019-12-18 21:20:35
问题 I know that transforming a square into a trapezoid is a linear transformation, and can be done using the projective matrix, but I'm having a little trouble figuring out how to construct the matrix. Using the projective matrix to translate, scale, rotates, and shear is straightforward. Is there a simple projective matrix which will transform a square to a trapezoid? 回答1: a,b,c,d are the four corners of your 2D square. a,b,c,d are expressed in homogeneous coordinate and so they are 3x1 matrices