苏州学做java_苏州JAVA培训

预约试听
编辑:佚名 发布时间:2018-10-25
苏州学做java
其然IT 教育师资

韩奇峰高级讲师

多年实战工作经验曾参与制作宝马Usage Training项目、DMS项目,奥迪全 息投影项目,奔驰等多家汽车门户行业大型项目,负责UI设计、界面设计、3D模型制作、前端开发等职务。

从事设计行业多年,精通PhotoShop、UI设计、AfterEffects、Flash、 Actionscript、HTML、CSS、JavaScript、jQuery、资深动画设计师,设计作品曾获得全国动画设计三等奖。

课程讲解注重实战应用,对讲述知识点穿插案例制作,使课程内容更加接近 工作中实际的项目。授课风格注重实战经验分析,深受学生喜欢。

苏州学做java

java入门要注意什么

苏州学做java

学习java就像是一个种花的过程,不断地为其施肥浇水,它才会茁壮成长。 而我们学习java,就要不断的充实自己、提升自己,才能获得更多机会。很多开始学习java编程的小白,经常就会被概念、定义什么的搞糊涂。当分类 、对象、接口、构造函数等等各种专业名词出现的时候,你一定是脑子里好像一片空白,根本就搞不懂这些字眼的意思和关系,而且,这种情况下,很 容易导致你丧失自信心,开始逃避、拒绝,这些小白经常遇到的情况在我刚接触java的时候也遇见了,但是好在我足够幸运,遇见了诚筑说。我现在已 经是公司的项目经理了,今天,我为大家来总结了一些经验和建议,希望能够帮助到大家。

一点:熟练基本的j2seAPI

除去java语言本身的语法之外呢,要懂得并且熟练j2seAPI的API也是非常有 必要的,在这里,就建议大家首先去掌握字符串的处理、异常的处理、容器、输入输出、线程等,这些相对来说较为重要的。还有就是API的内容是非 常庞大的,关于API,一定要懂得查询API的文件说明,在了解了其作用用途或者目的才能够进行相对于的程序。

二点:稳固java的语法基础

学习java一定要学会使用java的程序语言,用来编写程序,但是学习程序语 言就要熟悉语法是怎么使用的。程序语言其实也是一种语言,不过跟人类的语言不同,这种语言是要和计算机沟通交流,那怎么做才能熟悉这种语言呢 ,我给出的建议是多看别人写的程序,了解人家是怎么用java来解决问题的。然后再找类似的程序去练习了,这样就能够从实际操作中检验自己是否真 的知道该怎么去解决问题了。

三点:加入贴吧论坛多参与讨论

根据我当时的经验,在大家学习的过程中,如果有人可以参与话题,共同讨 论的话,会加快你学习的速度。所以大家可以和我一样,找一个技术讨论的地方,贴吧啊,论坛啊都可以,在这里进行讨论,毕竟大家有着共同的目标 和理想,有着共同的话题可聊,这样的话,又大大节省了学习的时间。

学完基本的java语法呢,现在就该用java来进行实际的编程了,假如你需要 编写窗口程序,那就学Swing窗口设计;假如你要编写数据库什么的,那就学JDBC等等。

Java基础语法

苏州学做java

Java基础语法

Java基础语法

流程控制语句

Java 编译器执行流程

if 分支结构

switch 选择结构与相关规则

循环结构

for 循环

while 循环

do-while 循环语句

各语句性能对比与应用场景

特殊流程控制语句

方法的声明与使用

方法调用的过程分析

跨类调用方法

参数的值传递

方法的重载 Overload

IOS使用AVFoundation在视频上添加字幕以及控制字幕时间


>

IOS在视频上添加字幕效果的基本思路是:

使用自定义的CATextLayer文字图层或者CAShapeLayer文字图层,添加到视频的Layer上创建用户自定义的字幕效果。这两者的区别是:CATextLayer支持设置简单的文字效果,包括文字的内容、字体、字号大小、对其方式、文字颜色、背景颜色等基本的属性;CAShapeLayer功能更强大,提供了CATextLayer没有的边框大小、边框颜色等设置,如果需要更高级的文字内容展示,需要使用CATextLayer配合UIBezierPath来定制自定义的文字内容。

通过设置Layer图层的动画来控制字幕的时间点和时间长度,这里有一个坑如果单独设置CATextLayer或者CAShapeLayer的动画不能控制开始的时间,需要额外添加一个CALayer图层,把文字图层CATextLayer或者CAShapeLayer添加到父CALayer图层中,在文字图层CATextLayer或者CAShapeLayer上设置开始的动画

NSTimeInterval animatedInStartTime = startTime initAnimationDuration; CABasicAnimation *fadeInAnimation = [CABasicAnimation animationWithKeyPath:@"opacity"]; fadeInAnimation.fromValue = @0.0f; fadeInAnimation.toValue = @1.0f; fadeInAnimation.additive = ; fadeInAnimation.removedOnCompletion = ; fadeInAnimation.beginTime = animatedInStartTime; fadeInAnimation.duration = animationDuration; fadeInAnimation.autoreverses = ; fadeInAnimation.fillMode = kCAFillModeBoth; [textLayer addAnimation:fadeInAnimation forKey:@"opacity"];

在父CALayer图层上设置结束的动画,这样设置才能实现用户自定义的时间点和时间长度

NSTimeInterval animatedOutStartTime = startTime duration - animationDuration; CABasicAnimation *fadeOutAnimation = [CABasicAnimation animationWithKeyPath:@"opacity"]; fadeOutAnimation.fromValue = @1.0f; fadeOutAnimation.toValue = @0.0f; fadeOutAnimation.additive = ; fadeOutAnimation.removedOnCompletion = ; fadeOutAnimation.beginTime = animatedOutStartTime; fadeOutAnimation.duration = animationDuration; fadeOutAnimation.autoreverses = ; fadeOutAnimation.fillMode = kCAFillModeBoth; [animatedTitleLayer addAnimation:fadeOutAnimation forKey:@"opacity"];

完整的代码

- (CALayer *)buildLayerbuildTxt:(NSString*)text textSize:(CGFloat)textSize textColor:(UIColor*)textColor strokeColor:(UIColor*)strokeColor opacity:(CGFloat)opacity textRect:(CGRect)textRect fontPath:(NSString*)fontPath viewBounds:(CGSize)viewBounds startTime:(NSTimeInterval)startTime duration:(NSTimeInterval)duration { if (!text || [text isEqualToString:@""]) { return nil; } // Create a layer for the overall title animation. CALayer *animatedTitleLayer = [CALayer layer]; // 1. Create a layer for the text of the title. CATextLayer *titleLayer = [CATextLayer layer]; titleLayer.string = text; titleLayer.font = (__bridge CFTypeRef)(@"Helvetica"); titleLayer.fontSize = textSize; titleLayer.alignmentMode = kCAAlignmentCenter; titleLayer.bounds = CGRectMake(0, 0, textRect.size.width, textRect.size.height); titleLayer.foregroundColor = textColor.CGColor; titleLayer.backgroundColor = [UIColor clearColor].CGColor; // [animatedTitleLayer addSublayer:titleLayer]; // 添加文字以及边框效果 UIFont *font = nil; if ((fontPath != nil) && (fontPath.length > 0)) { font = [[FLVideoEditFontManager sharedFLVideoEditFontManager] fontWithPath:fontPath size:textSize]; titleLayer.font = CGFontCreateWithFontName((__bridge CFStringRef)font.fontName); } if (font == nil) { titleLayer.font = (__bridge CFTypeRef)(@"Helvetica"); } UIBezierPath *path = nil; if (font) { path = [FLLayerBuilderTool createPathForText:text fontHeight:textSize fontName:(__bridge CFStringRef)(font.fontName)]; } else { path = [FLLayerBuilderTool createPathForText:text fontHeight:textSize fontName:CFSTR("Helvetica")]; } CGRect rectPath = CGPathGetBoundingBox(path.CGPath); CAShapeLayer *textLayer = [CAShapeLayer layer]; textLayer.path = path.CGPath; textLayer.lineWidth = 1; if (strokeColor != nil) { textLayer.strokeColor = strokeColor.CGColor; } if (textColor != nil) { textLayer.fillColor = textColor.CGColor; } textLayer.lineJoin = kCALineJoinRound; textLayer.lineCap = kCALineCaPRound; textLayer.geometryFlipped = ; textLayer.opacity = opacity; textLayer.bounds = CGRectMake(0, 0, rectPath.size.width, textSize 10); [animatedTitleLayer addSublayer:textLayer]; // 动画图层位置 animatedTitleLayer.position = CGPointMake(textRect.origin.x textRect.size.width/2, viewBounds.height - textRect.size.height/2 - textRect.origin.y); NSTimeInterval initAnimationDuration = 0.1f; NSTimeInterval animationDuration = 0.1f; // 3.显示动画 NSTimeInterval animatedInStartTime = startTime initAnimationDuration; CABasicAnimation *fadeInAnimation = [CABasicAnimation animationWithKeyPath:@"opacity"]; fadeInAnimation.fromValue = @0.0f; fadeInAnimation.toValue = @1.0f; fadeInAnimation.additive = ; fadeInAnimation.removedOnCompletion = ; fadeInAnimation.beginTime = animatedInStartTime; fadeInAnimation.duration = animationDuration; fadeInAnimation.autoreverses = ; fadeInAnimation.fillMode = kCAFillModeBoth; [textLayer addAnimation:fadeInAnimation forKey:@"opacity"]; NSTimeInterval animatedOutStartTime = startTime duration - animationDuration; CABasicAnimation *fadeOutAnimation = [CABasicAnimation animationWithKeyPath:@"opacity"]; fadeOutAnimation.fromValue = @1.0f; fadeOutAnimation.toValue = @0.0f; fadeOutAnimation.additive = ; fadeOutAnimation.removedOnCompletion = ; fadeOutAnimation.beginTime = animatedOutStartTime; fadeOutAnimation.duration = animationDuration; fadeOutAnimation.autoreverses = ; fadeOutAnimation.fillMode = kCAFillModeBoth; [animatedTitleLayer addAnimation:fadeOutAnimation forKey:@"opacity"]; return animatedTitleLayer; }

依赖的工具类FLLayerBuilderTool.m文件:

#import "FLLayerBuilderTool.h" #import <CoreText/CoreText.h> @implementation FLLayerBuilderTool (UIBezierPath*) createPathForText:(NSString*)string fontHeight:(CGFloat)height fontName:(CFStringRef)fontName { if ([string length] < 1) return nil; UIBezierPath *combinedGlyphsPath = nil; CGMutablePathRef letters = CGPathCreateMutable(); CTFontRef font = CTFontCreateWithName(fontName, height, NULL); if (font == nil) { font = (__bridge CFTypeRef)(@"Helvetica"); } NSDictionary *attrs = [NSDictionary dictionaryWithObjectsAndKeys: (__bridge id)font, kCTFontAttributeName, nil]; NSAttributedString *attrString = [[NSAttributedString alloc] initWithString:string attributes:attrs]; CTLineRef line = CTLineCreateWithAttributedString((CFAttributedStringRef)attrString); CFArrayRef runArray = CTLineGetGlyphRuns(line); // for each RUN for (CFIndex runIndex = 0; runIndex < CFArrayGetCount(runArray); runIndex ) { // Get FONT for this run CTRunRef run = (CTRunRef)CFArrayGetValueAtIndex(runArray, runIndex); CTFontRef runFont = CFDictionaryGetValue(CTRunGetAttributes(run), kCTFontAttributeName); // for each GLYPH in run for (CFIndex runGlyphIndex = 0; runGlyphIndex < CTRunGetGlyphCount(run); runGlyphIndex ) { // get Glyph & Glyph-data CFRange thisGlyphRange = CFRangeMake(runGlyphIndex, 1); CGGlyph glyph; CGPoint position; CTRunGetGlyphs(run, thisGlyphRange, &glyph); CTRunGetPositions(run, thisGlyphRange, &position); // Get PATH of outline { CGPathRef letter = CTFontCreatePathForGlyph(runFont, glyph, NULL); CGAffineTransform t = CGAffineTransformMakeTranslation(position.x, position.y); CGPathAddPath(letters, &t, letter); CGPathRelease(letter); } } } CFRelease(line); combinedGlyphsPath = [UIBezierPath bezierPath]; [combinedGlyphsPath moveToPoint:CGPointZero]; [combinedGlyphsPath appendPath:[UIBezierPath bezierPathWithCGPath:letters]]; CGPathRelease(letters); CFRelease(font); if (attrString) { attrString = nil; } return combinedGlyphsPath; } @end

参考资料: 视频特效制作:如何给视频添加边框、水印、动画以及3D效果 视频特效制作2 AVFoundation Tutorial: Adding Overlays and Animations to Videos


相关推荐:


苏州JAVA培训   苏州JAVA培训班   苏州JAVA培训机构

抢限时体验课

相关推荐

猜你喜欢

同类学校

Copyright © 2006-2018 kaoshi.china.com