+[doc] add blog
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/d2b5104f Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/d2b5104f Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/d2b5104f Branch: refs/heads/0.16-dev Commit: d2b5104f1596676b500c0c42010357bb79eae57e Parents: beb83d2 Author: tancy <ron...@gmail.com> Authored: Fri Jul 28 15:58:06 2017 +0800 Committer: tancy <ron...@gmail.com> Committed: Fri Jul 28 15:58:06 2017 +0800 ---------------------------------------------------------------------- doc/source/_posts/arkit.md | 112 ++++++++++++++++++++ doc/source/_posts/cn/hello.md | 6 -- doc/source/_posts/hello_world.md | 7 -- doc/source/_posts/test.md | 14 --- doc/source/cn/blog/index.md | 4 - doc/themes/weex/layout/_partial/header.ejs | 1 + doc/themes/weex/source/css/blog.scss | 3 + doc/themes/weex/source/css/media-queries.scss | 1 + doc/themes/weex/source/css/partial/header.scss | 6 +- 9 files changed, 120 insertions(+), 34 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/d2b5104f/doc/source/_posts/arkit.md ---------------------------------------------------------------------- diff --git a/doc/source/_posts/arkit.md b/doc/source/_posts/arkit.md new file mode 100644 index 0000000..2b97c6e --- /dev/null +++ b/doc/source/_posts/arkit.md @@ -0,0 +1,112 @@ +title: Weex â¤ï¸ iOS 11 ç³»åä¹ä¸ï¼ARKitåæ¢ +type: blog +date: 2017-06-27 14:32:10 + +--- + +## ARKit +è¹æå¨wwdc 2017å ¬å¸äºç¬¬ä¸æ¬¾å ·æARåè½çæä½ç³»ç»iOS11ï¼å¹¶æä¾äºARçSDKï¼ARKitï¼åæ¶å®£ç§°è¹ææ¯ä¸çä¸æ大çARå¹³å°ï¼Weexä¹ç§¯ææ¥æ±ARï¼è®©Weexç¨æ·ä¹å¯ä»¥æ¹ä¾¿å¼åARåè½ + +ARä½éªå°±æ¯å建å追踪ç¨æ·æå¨çç°å®ä¸çåå¯å»ºç«æ¨¡åç空é´ç对åºå ³ç³»çè½åï¼è®©ç¨æ·æè§äº§çèæå 容å¨ç°å®ä¸ççéè§ï¼è¿å°±æ¯æè°çå¢å¼ºç°å®ãARKitéè¿è¯å«å¾ååºæ¯ä¸çæ¾èç¹å¾ï¼è¿½è¸ªè¿äºç¹å¾çå·®å¼ä½ç½®ï¼æåä¸ä¼ æå¨æ°æ®æ¯è¾ï¼å¾å°è®¾å¤ä½ç½®åè¿å¨ç¶æçé«ç²¾åº¦æ¨¡å + +## åç +ARkit å¨ARSCNViewï¼ARSession,ARFrameçåºç¡ä¸å®ç° + +### ARSCNViewåARSession +![x](http://upload-images.jianshu.io/upload_images/6271687-d5b0e534ef0d7aaa.png?imageMogr2/auto-orient/strip%7CimageView2/2) +ARKitæä¾äºä¸¤ç§å¢å¼ºç°å®çè§å¾ï¼ä»ä»¬åå«æ¯ARSCNView(3D)åARSKView(2D),è¿ä¸¤ç§è§å¾é½éç¨ARCameraä½ä¸ºè§å¾èæ¯çï¼èARSCNViewçè§å¾åç¸æºæ²¡æç´æ¥å ³ç³»ï¼ä»ä»¬æ¯éè¿ARSessionè¿ä¸ªæ¡¥æ¢åcamera交äºçï¼è¿è¡ä¸ä¸ªsessionï¼éè¦æå®ä¼è¯è¿½è¸ªé ç½®ç对象ï¼ARSessionConfigurationï¼ARSessionConfigurationè´è´£è¿½è¸ªç¸æºå¨3Dä¸çä¸çä½ç½®åå¹³é¢æ¢æµ + +### ARWorldTrackingSessionConfigurationä¸ARFrame +![x](https://github.com/kfeagle/firstdemo/blob/master/arkit.png?raw=true) +ARWorldTrackingSessionConfigurationéè¿ä¸ç³»åçå¤æ计ç®åè°ç¨ä¼ æå¨æ¥è·è¸ªè®¾å¤çæ¹ååä½ç½®ï¼å½ARWorldTrackingSessionConfiguration计ç®åºä½ç½®ï¼ä¼äº¤ç»ARSession管ç,ARSessionå°±ä¼ç»´æ¤ä¸ä¸ªç¸æºçä½ç½®ARFameï¼ç¨æ·å¯ä»¥éè¿è¿ä¸ªframeå°4x4ç©éµä¸çåæ 转æ¢ä¸º3Dç³»ç»ç¸æºåæ + +## weex-ar +ARKitå¨wwdcä¸å¸¦æ¥çéæ¼ææï¼æéè¿weexæ件çæ¹å¼å°ARKitè½åéä¼ å°Weexï¼è®©ç¨æ·å¨weexä¸ä¹ç¬¬ä¸æ¶é´ä½éªå°NativeçARææ +ææçdemo以åæºç æå·²ç»å¼æºï¼åæ¥å°[github](https://github.com/kfeagle/weex-ar)ï¼ç¨æ·å¨èªå·±å·¥ç¨ä¾èµå³å¯ä½¿ç¨ + +### å¨ç°å®ä¸ç渲æä¸ä¸ª3Dçèæç©ä½ +``` +this.$refs['scene'].addNode({ + name:'color', + width:0.1, + height:0.1, + length:0.1, + chamferRadius:0, + vector:{ + x:0.1, + y:0.1, + z:-0.5 + }, + contents:{ + type:'color', + name:'red' + } + }); +``` +Weexå¨compnonentä¸å¢å addNodeæ¹æ³ï¼ç¨æ·å¯ä»¥è®¾ç½®å¥½èç¹çåæ°ï¼ç¶åå°±ä¼æ建ä¸ä¸ªèæç©ä½ +- ææ + - ![x](http://gitlab.alibaba-inc.com/Jerry/amapdemo/raw/master/ar/1.gif) + +### 交äºæ¯æ +å½native触åäºç¹å»äºä»¶ï¼ä¼åjsfmåéç¹å»ä½ç½®ä¿¡æ¯ + +``` +-(void)tapped:(UITapGestureRecognizer *)recognizer +{ + SCNView *sceneView = (SCNView *)recognizer.view ; + CGPoint touchLocation = [recognizer locationInView:sceneView]; + [self fireEvent:@"tap" params:@{@"touchLocation":@{@"x":@(touchLocation.x),@"y":@(touchLocation.y)}}]; +} +``` +å½VUEæ¥æ¶å°ç¸å ³ä¿¡æ¯ï¼ä¼å¤çä½ç½®ä¿¡æ¯ï¼ç¶åæ´æ°èç¹ +``` +tap:function (event) { + this.index = this.index+1; + if(this.index>3){ + this.index = 0; + } + var color = 'red'; + if(this.index == 1){ + color = 'blue'; + } + if(this.index == 2){ + color = 'green'; + } + if(this.index == 3){ + color = 'yellow'; + } + this.$refs['scene'].updateNode({ + name:'color', + x:event.touchLocation.x, + y:event.touchLocation.y, + color:color + }) + } +``` +- ææ + - ![x](http://gitlab.alibaba-inc.com/Jerry/amapdemo/raw/master/ar/tap.gif) + +### 碰æ游æ +设置èç¹çmaskï¼éè¿arkitç代çå°±å¯ä»¥æ£æµç¢°æäº +``` +node.physicsBody.categoryBitMask= [self getMask:[WXConvert NSInteger:[options objectForKey:@"categoryBitMask"]]]; + node.physicsBody.contactTestBitMask= [self getMask:[WXConvert NSInteger:[options objectForKey:@"contactTestBitMask"]]]; +``` +å½ç¢°æåçæ¶åï¼ä¼éè¿physicsWorld:(SCNPhysicsWorld *)world didBeginContact:(SCNPhysicsContact *)contact代çè·åå°èç¹çä¿¡æ¯ï¼weexå°ç¸å ³ä¿¡æ¯åéå°jsfm +vueè·åå å ³èç¹å¯ä»¥å é¤èç¹ï¼å¢åèç¹ï¼ä»èå®æ碰æçå¤ç +``` +contact:function (event) { + if(event.nodes.nodeA.mask == 0 || event.nodes.nodeB.mask == 0 ){ + + this.isAdd = false; + this.$refs['scene'].removeNode(event.nodes.nodeA.name); + this.$refs['scene'].removeNode(event.nodes.nodeB.name); + + } + + } +``` + +- ææ + + - ![x](http://gitlab.alibaba-inc.com/Jerry/amapdemo/raw/master/ar/game.gif) \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/d2b5104f/doc/source/_posts/cn/hello.md ---------------------------------------------------------------------- diff --git a/doc/source/_posts/cn/hello.md b/doc/source/_posts/cn/hello.md deleted file mode 100644 index da43361..0000000 --- a/doc/source/_posts/cn/hello.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -title: hello -lang: cn -date: 2016-12-27 15:54:28 -type: blog ---- http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/d2b5104f/doc/source/_posts/hello_world.md ---------------------------------------------------------------------- diff --git a/doc/source/_posts/hello_world.md b/doc/source/_posts/hello_world.md deleted file mode 100644 index 803ef70..0000000 --- a/doc/source/_posts/hello_world.md +++ /dev/null @@ -1,7 +0,0 @@ -title: Hello World -type: blog - ---- - -# Hello world - http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/d2b5104f/doc/source/_posts/test.md ---------------------------------------------------------------------- diff --git a/doc/source/_posts/test.md b/doc/source/_posts/test.md deleted file mode 100644 index afaa8ec..0000000 --- a/doc/source/_posts/test.md +++ /dev/null @@ -1,14 +0,0 @@ -title: test -type: blog - ---- - - -# test - -asdfadfasdfasdfadfadsf -asdfasdfadsf -adsfadsfadsf - -## sdfasdfasdf -sdfsdfsdf \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/d2b5104f/doc/source/cn/blog/index.md ---------------------------------------------------------------------- diff --git a/doc/source/cn/blog/index.md b/doc/source/cn/blog/index.md deleted file mode 100644 index ef7b31d..0000000 --- a/doc/source/cn/blog/index.md +++ /dev/null @@ -1,4 +0,0 @@ -type: blog -index: true -layout: blog ---- \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/d2b5104f/doc/themes/weex/layout/_partial/header.ejs ---------------------------------------------------------------------- diff --git a/doc/themes/weex/layout/_partial/header.ejs b/doc/themes/weex/layout/_partial/header.ejs index 4c7d92d..5b5701f 100644 --- a/doc/themes/weex/layout/_partial/header.ejs +++ b/doc/themes/weex/layout/_partial/header.ejs @@ -36,6 +36,7 @@ </li> </ul> </li> + <li><a href="/blog"><%= _p('menu.blog') %></a></li> </ul> <ul class="info"> <li><a href="https://github.com/apache/incubator-weex/" target="_blank"><span class="btn-github iconfont icon-github"></span></a></li> http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/d2b5104f/doc/themes/weex/source/css/blog.scss ---------------------------------------------------------------------- diff --git a/doc/themes/weex/source/css/blog.scss b/doc/themes/weex/source/css/blog.scss index 7e2cd9d..4f5fb55 100644 --- a/doc/themes/weex/source/css/blog.scss +++ b/doc/themes/weex/source/css/blog.scss @@ -24,6 +24,9 @@ .blog-article-inner { padding: 0 1.45em; margin-bottom: 50px; + a{ + line-height: 120% + } } .more-link { http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/d2b5104f/doc/themes/weex/source/css/media-queries.scss ---------------------------------------------------------------------- diff --git a/doc/themes/weex/source/css/media-queries.scss b/doc/themes/weex/source/css/media-queries.scss index f31a880..317223c 100644 --- a/doc/themes/weex/source/css/media-queries.scss +++ b/doc/themes/weex/source/css/media-queries.scss @@ -89,6 +89,7 @@ } } + @media screen and (max-width: 700px) { /*********************************************** * Index http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/d2b5104f/doc/themes/weex/source/css/partial/header.scss ---------------------------------------------------------------------- diff --git a/doc/themes/weex/source/css/partial/header.scss b/doc/themes/weex/source/css/partial/header.scss index f109404..ac02f1a 100644 --- a/doc/themes/weex/source/css/partial/header.scss +++ b/doc/themes/weex/source/css/partial/header.scss @@ -3,7 +3,7 @@ #header { width: 100%; height: 72px; - padding: 0 65px; + padding: 0 40px; position: fixed; background-color: rgba(255, 255, 255, .95); box-shadow: 3px 2px 4px 0 rgba(0,0,0,0.12); @@ -74,12 +74,12 @@ } > li + li { - margin-left: 40px; + margin-left: 30px; } } .info li { - margin-left: 40px; + margin-left: 30px; } .tools {